jamesmills / laravel-admin
A very simple admin panel for managing users, roles & permissions.
Requires
- php: >=5.5.9
- illuminate/support: ^5.1
- laracasts/flash: ^3.0
- laravelcollective/html: ~5.1
This package is auto-updated.
Last update: 2019-11-13 09:54:52 UTC
README
A very simple admin panel for managing users, roles & permissions.
The premise for this package is to eradicate the duplicate work I do for every new Laravel project I setup.
You will get a default user who has the role of admin. You will be able to log into the system with this user and manage all roles and permissions using a simple Bootstrap UI. The default yourapp.local/admin
route will be restricted to users with admin role only. You will get a good default to build your application views and backend views separately.
Installation
Note: This package should be run as soon as you have created a new laravel project.
- Run
composer require jamesmills/laravel-admin
- Install the admin package.
php artisan laravel-admin:install
What this packages does
- Install the below packages
- Run a migration
- Create tables for
roles
,role_user
,permissions
,permission_role
- Create tables for
- Create a new user
Admin User (admin@domain.com)
with the passwordp455word
- Publish the Laravel Auth view files using 'php artisan make:auth'
- Publish some additional view/template files
- All CRUD view files for
users
,roles
andpermissions
- A dedicated backend template
resources/views/templates/backend.blade.php
- All CRUD view files for
- Replace the AuthServiceProvider class with a new version
- Replace the web routes file with a new version
- Replaces the
User
model with a new version so that it has theHasRoles
trail reference
Roles & Permissions
- Create some roles.
- Create some permissions.
- Give permission(s) to a role.
- Create user(s) with role.
- For checking authenticated user's role see below:
// Check role anywhere if (auth()->check() && auth()->user()->hasRole('admin')) { // Do admin stuff here }
- For checking permissions see below:
if ($user->can('permission-name')) { // Do something }
Learn more about ACL from here
Acknowledgements
The origin of this package is a fork from appzcoder/laravel-admin by Sohel Amin.
Note: I cloned the original project and created this so that I could remove the CRUD stuff.