https://github.com/sohelamin/laravel-admin
Laravel Admin Panel
https://github.com/sohelamin/laravel-admin
laravel laravel-admin laravel-admin-panel php
Last synced: 26 days ago
JSON representation
Laravel Admin Panel
- Host: GitHub
- URL: https://github.com/sohelamin/laravel-admin
- Owner: sohelamin
- License: mit
- Created: 2016-03-25T09:06:16.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2023-01-31T13:34:43.000Z (over 2 years ago)
- Last Synced: 2024-04-14T11:08:33.335Z (about 1 year ago)
- Topics: laravel, laravel-admin, laravel-admin-panel, php
- Language: PHP
- Homepage: https://packagist.org/packages/appzcoder/laravel-admin
- Size: 151 KB
- Stars: 721
- Watchers: 55
- Forks: 264
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Laravel Admin Panel
An admin panel for managing users, roles, permissions & crud.### Requirements
Laravel >=5.5
PHP >= 7.0## Features
- User, Role & Permission Manager
- CRUD Generator
- Activity Log
- Page CRUD
- Settings## Installation
1. Run
```
composer require appzcoder/laravel-admin
```2. Install the admin package.
```
php artisan laravel-admin:install
```
> Service provider will be discovered automatically.
3. Make sure your user model's has a ```HasRoles``` trait **app/Models/User.php**.
```php
class User extends Authenticatable
{
use Notifiable, HasRoles;...
```4. You can generate CRUD easily through generator tool now.
Note: If you are using Laravel 7+ then scaffold the authentication with bootstrap for a better experience.
## Usage
1. Create some permissions.
2. Create some roles.
3. Assign permission(s) to role.
4. Create user(s) with role.
5. For checking authenticated user's role see below:
```php
// Add role middleware in app/Http/Kernel.php
protected $routeMiddleware = [
...
'role' => \App\Http\Middleware\CheckRole::class,
];
``````php
// Check role anywhere
if (Auth::check() && Auth::user()->hasRole('admin')) {
// Do admin stuff here
} else {
// Do nothing
}// Check role in route middleware
Route::group(['namespace' => 'Admin', 'prefix' => 'admin', 'middleware' => ['auth', 'role:admin']], function () {
Route::get('/', ['uses' => 'AdminController@index']);
});// Check permission in route middleware
Route::group(['namespace' => 'Admin', 'prefix' => 'admin', 'middleware' => ['auth', 'can:write_user']], function () {
Route::get('/', ['uses' => 'AdminController@index']);
});
```6. For checking permissions see below:
```php
if ($user->can('permission-name')) {
// Do something
}
```Learn more about ACL from [here](https://laravel.com/docs/master/authorization)
For activity log please read `spatie/laravel-activitylog` [docs](https://docs.spatie.be/laravel-activitylog/v2/introduction)
## Screenshots




## Author
[Sohel Amin](http://www.sohelamin.com) :email: [Email Me](mailto:[email protected])
## License
This project is licensed under the MIT License - see the [License File](LICENSE) for details