Using SystemRoles in Your App
Customising the Admin Screens
On this page
The admin screens are Blade views under the systemroles:: namespace. They use Bootstrap 5, DataTables, Remix Icon and Font Awesome, loaded from public/vendor/systemroles.
Publish the views#
php artisan vendor:publish --tag=systemroles-viewsThe views are copied to resources/views/vendor/systemroles/. Laravel uses your copies first, so you can edit them freely. Package updates will not overwrite them, so compare them with the package's versions after upgrading.
View map#
| View | Screen |
|---|---|
layouts/ |
Page shell: top bar, sidebar, content area |
layouts/ |
Sidebar links |
layouts/ |
Top bar with the logout button |
layouts/ |
Footer |
layouts/, logo. |
Logos |
layouts/ |
Favicons, meta tags, icon fonts, flash messages |
roles/ |
Roles list |
roles/ |
One role's permission matrix |
roles/ |
All permissions |
roles/ |
Users and role assignment |
roles/ |
Controllers list |
roles/ |
One controller's role access |
modals/ |
Add/edit role, add/edit permission, assign role, confirm dialogs |
The routes and menus screens look for roles/routes/index, roles/routes/manage, menus/index, menus/items, menus/manage and menus/items-manage. These do not ship yet. Create them in resources/views/vendor/systemroles/ to enable those screens. The controllers pass the variables listed in Package Routes.
Common changes#
Logo and footer partials#
layouts/partials/admin-logo.blade.php, logo.blade.php and admin-footer.blade.php are not included by the default layout, and they contain branding from the package author's other projects. If you include them in your layout, replace their content with your own logo and footer first.
Use your app's layout#
Make each screen extend your own layout instead of systemroles::layouts.admin:
{{-- resources/views/vendor/systemroles/roles/index.blade.php --}}
@extends('layouts.app')Keep the @section names the screens use (title, css, content, javascript, and breadcrumbs, which the default layout does not display) or rename them to match your layout. Your layout must include Bootstrap 5's JavaScript for the modals, and jQuery + DataTables for the Users screen.
Logout#
The top bar and sidebar post to the route named logout. If your app has no route by that name, define one or edit those two partials.
Link back to your app#
Add a link to your dashboard in layouts/menus/admin-sidebar-menu.blade.php:
<li class="menu-item">
<a class="menu-link" href="{{ url(config('systemroles.dashboard_url')) }}">
<i class="ri-arrow-go-back-line"></i> <span>Back to app</span>
</a>
</li>Assets#
php artisan vendor:publish --tag=systemroles-assets --forceRe-run this after upgrading the package, so public/vendor/systemroles matches the new version. Your own CSS can go in @section('css') or in a published copy of assets/css/systemroles.css.