Laravel Admin is a drop-in admin panel package for Laravel which promotes rapid scaffolding & development, uses Material Dashboard
-
The project is based on the Laravel Admin Panel and Material Dashboard Laravel.
-
This package has a modular approach, for which it uses the Laravel module, see the documentation for more information on this approach: https://github.com/nWidart/laravel-modules
-
Installing this package will publish the
Admin
module in theModules
folder at the root of your project.
Laravel >=7
PHP >= 7.0
- Admin User, Role & Permission Manager:
- Activity Log:
- Page CRUD:
- Settings:
- Login, Forgot Password
- Profile
After initializing instance of Laravel
-
Autoloading: By default, module classes are not loaded automatically. You can autoload your modules using
psr-4
, add"Modules\\": "Modules/"
in composer.json.{ "autoload": { "psr-4": { "App\\": "app/", "Modules\\": "Modules/", } } }
Tip: don't forget to run
composer dump-autoload
afterwards. -
Run
composer require jjanampa/laravel-admin
-
Install the admin package.
php artisan laravel-admin:install
Service provider will be discovered automatically.
execute
php artisan laravel-admin:install --force
to force the installation, this process recreate theAdmin
module, removes and recreates the following tables:admin_users, admin_roles, admin_permissions, admin_permission_role, admin_role_user, pages, settings
Visit (APP_URL)/admin
to access the admin panel.
The default admin login is:
Email Address: admin@admin.com
Password: secret
-
Create some permissions.
-
Create some roles.
-
Assign permission(s) to role.
-
Create user(s) with role.
-
For checking authenticated user's role see below:
// Check role anywhere if (auth('admin')->user()->hasRole('editor')) { // Do admin stuff here } else { // Do nothing } // Check role in route middleware Route::resource('pages', 'Dashboard\PagesController')->middleware('role:editor');
-
For checking permissions see below:
if (auth('admin')->user()->can('permission-name')) { // Do something }
Learn more about ACL from here
For activity log please read spatie/laravel-activitylog
docs
Admin Users | Admin Roles | Admin Permissions |
---|---|---|
Pages | Activity Log | Settings |
Profile | Login | Forgot Password |