This package adds an admin panel to your app.
composer require nanuc/laravel-admin
php artisan vendor:publish --provider="Nanuc\LaravelAdmin\LaravelAdminServiceProvider" --tag=config
This package assumes you want to access your admin panel at /admin
and have a route dashboard
(to return to from the admin panel). You can setup change this values in the config.
You can enable/disable modules in the modules
parameter. You can add own modules too - see "Customization".
Add the user accounts that are supposed to be admins to your .env.
[email protected],[email protected]
Add the trait Nanuc\LaravelAdmin\Traits\InteractsWithAdmin
to your User model.
Place a link to the route admin.home
somewhere in your navigation. Make sure that only admins will see it.
If you use Jetstream you can use <x-admin::admin-link/>
and <x-admin::admin-link-responsive/>
in your dropdown navigation menus. Only admins will see it by default.
Add <x-admin::impersonation/>
to the top of your layout to show information about who is being impersonated.
You can use the @admin
directive in your blade views.
@admin
Only admins can see this.
@endadmin
You can create own modules that will appear in the navigation. You have to create a class that extends Nanuc\LaravelAdmin\Modules\AdminModule
. See how Nanuc\LaravelAdmin\Modules\Users\Users
is built and start from there.
To import your own CSS/JS go to your laravel-admin config.
'styles' => [
env('APP_URL').'/path/to/your/custom.css',
],
'scripts' => [
env('APP_URL').'/path/to/your/custom.js',
],