nanuc / laravel-admin
Installs: 447
Dependents: 1
Suggesters: 0
Security: 0
Stars: 0
Watchers: 0
Forks: 0
Open Issues: 0
Language:Blade
Requires
- php: ^7.4|^8.0
- blade-ui-kit/blade-heroicons: ^1.1
- lab404/laravel-impersonate: ^1.7
- livewire/livewire: ^2.3
- rappasoft/laravel-livewire-tables: ^1.15
Requires (Dev)
- orchestra/testbench: ^6.0
This package is not auto-updated.
Last update: 2025-03-11 02:52:44 UTC
README
This package adds an admin panel to your app.
Installation
composer require nanuc/laravel-admin
Publish config
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".
Edit .env
Add the user accounts that are supposed to be admins to your .env.
ADMINS=user1@example.com,user2@example.com
Impersonation
Add the trait Nanuc\LaravelAdmin\Traits\InteractsWithAdmin
to your User model.
Usage
Link to admin area
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.
Impersonation information
Add <x-admin::impersonation/>
to the top of your layout to show information about who is being impersonated.
Blade views
You can use the @admin
directive in your blade views.
@admin
Only admins can see this.
@endadmin
Customization
Custom Modules
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.
Custom CSS/JS
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',
],