Skip to content

Commit

Permalink
Making sure that the routes are protected by middleware of 'auth'
Browse files Browse the repository at this point in the history
  • Loading branch information
Ihabafia committed May 15, 2024
1 parent b0f5e14 commit f48ea58
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
6 changes: 3 additions & 3 deletions resources/views/admin-navigation.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
<x-dropdown align="right" width="48">
<x-slot name="trigger">
<button class="inline-flex items-center px-3 py-2 border border-transparent text-sm leading-4 font-medium rounded-md text-gray-500 dark:text-gray-400 bg-white dark:bg-gray-800 hover:text-gray-700 dark:hover:text-gray-300 focus:outline-none transition ease-in-out duration-150">
<div>{{ Auth::user()->name }}</div>
<div>{{ auth()->check() ? auth()->user()->name : null }}</div>

<div class="ms-1">
<svg class="fill-current h-4 w-4" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20">
Expand Down Expand Up @@ -90,8 +90,8 @@
<!-- Responsive Settings Options -->
<div class="pt-4 pb-1 border-t border-gray-200 dark:border-gray-600">
<div class="px-4">
<div class="font-medium text-base text-gray-800 dark:text-gray-200">{{ Auth::user()->name }}</div>
<div class="font-medium text-sm text-gray-500">{{ Auth::user()->email }}</div>
<div class="font-medium text-base text-gray-800 dark:text-gray-200">{{ auth()->check() ? auth()->user()->name : null }}</div>
<div class="font-medium text-sm text-gray-500">{{ auth()->check() ? auth()->user()->email : null }}</div>
</div>

{{--<div class="mt-3 space-y-1">
Expand Down
13 changes: 8 additions & 5 deletions src/PermissionsAdminServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,14 @@ public function configurePackage(Package $package): void
public function packageRegistered()
{
Route::macro('rolesPermissionsAdmin', function (string $baseUrl = '/') {
Route::prefix($baseUrl)->group(function () {
Route::get('users', UserComponent::class)->name('users');
Route::get('roles', RoleComponent::class)->name('roles');
Route::get('permissions', PermissionComponent::class)->name('permissions');
});
Route::middleware('auth')
->prefix($baseUrl)
->group(function () {
Route::get('users', UserComponent::class)->name('users');
Route::get('roles', RoleComponent::class)->name('roles');
Route::get('permissions', PermissionComponent::class)
->name('permissions');
});
});
}
}

0 comments on commit f48ea58

Please sign in to comment.