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#

Bash
php artisan vendor:publish --tag=systemroles-views

The 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/admin.blade.php Page shell: top bar, sidebar, content area
layouts/menus/admin-sidebar-menu.blade.php Sidebar links
layouts/partials/admin-top-nav.blade.php Top bar with the logout button
layouts/partials/admin-footer.blade.php Footer
layouts/partials/admin-logo.blade.php, logo.blade.php Logos
layouts/includes/*.blade.php Favicons, meta tags, icon fonts, flash messages
roles/index.blade.php Roles list
roles/manage.blade.php One role's permission matrix
roles/permissions.blade.php All permissions
roles/users.blade.php Users and role assignment
roles/classes/index.blade.php Controllers list
roles/classes/manage.blade.php One controller's role access
modals/*.blade.php 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#

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:

Blade
{{-- 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.

Add a link to your dashboard in layouts/menus/admin-sidebar-menu.blade.php:

Blade
<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#

Bash
php artisan vendor:publish --tag=systemroles-assets --force

Re-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.