-
Notifications
You must be signed in to change notification settings - Fork 0
feat(admin): add protected admin area shell and dashboard entry #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,78 @@ | ||
| @php | ||
| $toolbarItems = [ | ||
| [ | ||
| 'label' => 'Ideas', | ||
| 'href' => route('home'), | ||
| 'icon' => 'heroicon-o-light-bulb', | ||
| ], | ||
| [ | ||
| 'label' => 'Planning', | ||
| 'href' => '#planning', | ||
| 'icon' => 'heroicon-o-clipboard-document-list', | ||
| ], | ||
| [ | ||
| 'label' => 'Development', | ||
| 'href' => '#development', | ||
| 'icon' => 'heroicon-o-code-bracket-square', | ||
| ], | ||
| [ | ||
| 'label' => 'Testing', | ||
| 'href' => '#testing', | ||
| 'icon' => 'heroicon-o-beaker', | ||
| ], | ||
| [ | ||
| 'label' => 'Security', | ||
| 'href' => '#security', | ||
| 'icon' => 'heroicon-o-shield-check', | ||
| ], | ||
| [ | ||
| 'label' => 'Ops', | ||
| 'href' => '#ops', | ||
| 'icon' => 'heroicon-o-command-line', | ||
| ], | ||
| ]; | ||
|
|
||
| $contextItems = [ | ||
| [ | ||
| 'label' => 'Dashboard', | ||
| 'href' => route('admin.dashboard'), | ||
| 'current' => true, | ||
| 'icon' => 'heroicon-o-squares-2x2', | ||
| ], | ||
| [ | ||
| 'label' => 'Users', | ||
| 'href' => '#users', | ||
| 'icon' => 'heroicon-o-users', | ||
| ], | ||
| [ | ||
| 'label' => 'Roles', | ||
| 'href' => '#roles', | ||
| 'icon' => 'heroicon-o-shield-check', | ||
| ], | ||
| ]; | ||
| @endphp | ||
|
|
||
| <x-layouts.app-shell | ||
| title="Admin" | ||
| :toolbar-items="$toolbarItems" | ||
| :context-items="$contextItems" | ||
| :show-admin-entry="true" | ||
| > | ||
| <div class="mx-auto max-w-5xl space-y-8"> | ||
| <x-ui.page-header | ||
| eyebrow="Admin" | ||
| title="Control center" | ||
| description="This area is reserved for administrative work and future user management." | ||
| /> | ||
|
|
||
| <x-ui.panel | ||
| title="Protected area" | ||
| subtitle="Access here is restricted to users with the admin role." | ||
| > | ||
| <p class="text-sm leading-7 text-muted"> | ||
| This dashboard is the first admin-only landing surface. It uses the same shell and shared components as the rest of the app, | ||
| but it stays behind the authorization gate and will grow into user, role, and system management from here. | ||
| </p> | ||
| </x-ui.panel> | ||
| </div> | ||
| </x-layouts.app-shell> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The admin toolbar entry visibility duplicates the authorization logic by checking
auth()->user()?->isAn('admin')directly. Since the route is protected withcan:access-admin(and the Gate is defined), consider switching this to@can('access-admin')/auth()->user()?->can('access-admin')so UI visibility stays consistent with the actual authorization rules if they change later.