kodeine/laravel-acl
Fork: 217 Star: 786 (更新于 2024-12-01 22:19:09)
license: MIT
Language: PHP .
Light-weight role-based permissions system for Laravel 6+ built in Auth system.
最后发布版本: 2.0.9 ( 2024-08-19 08:34:15)
Kodeine/Laravel-ACL
Laravel ACL adds role based permissions to built in Auth System of Laravel 9.0+. ACL middleware protects routes and even crud controller methods.
Table of Contents
Requirements
- Version 2.x of this package requires PHP 7.2+ and Laravel 6.0+
- Version 1.x requires PHP 5.6+ and Laravel 5.0+
Getting Started
Install the package using composer
composer require kodeine/laravel-acl
If you need to support Laravel 5.x, make sure to install version 1.x
composer require kodeine/laravel-acl "^1.0"
- If you are using Laravel before version 5.4, manually register the service provider in your config/app.php file
'providers' => [
'Illuminate\Foundation\Providers\ArtisanServiceProvider',
'Illuminate\Auth\AuthServiceProvider',
...
'Kodeine\Acl\AclServiceProvider',
],
- Publish the package configuartion files and add your own models to the list of ACL models"
$ php artisan vendor:publish --provider="Kodeine\Acl\AclServiceProvider"
Once you publish, it publishes the configuration file where you can:
- Use your own models: Define your own models which should extend to Acl models.
- Use your own guard: Define a guard other than laravel default for user recovery.
- Add the middleware to your
app/Http/Kernel.php
.
protected $routeMiddleware = [
....
'acl' => 'Kodeine\Acl\Middleware\HasPermission',
];
- Add the HasRole trait to your
User
model.
use Kodeine\Acl\Traits\HasRole;
class User extends Model implements AuthenticatableContract, CanResetPasswordContract
{
use Authenticatable, CanResetPassword, HasRole;
}
- Run the migrations to generate your roles and permissions tables
Please note that if you are upgrading to 6.0 from a previous version, the default column type for the id on the users table has changed. On certain databases foreign keys can only be defined with matching column types. As such, you will need to change the id column on your users table to bigInteger in to user this package.
php artisan migrate
Documentation
Follow along the Wiki to find out more.
Roadmap
Here's the TODO list for the next release.
- Refactoring the source code.
- Correct all issues.
- Adding cache to final user permissions.
Change Logs
June 14 2022
- Added support for different guard
September 14 2019
- Updated the readme to reflect new major release
September 13, 2019
- Added support for Laravel 6
September 22, 2016*
- Added unit tests
September 20, 2016*
- Added support for Laravel 5.3
September 19, 2016
- Added cache support to Roles and Permissions.
June 14, 2015
- Added backward compatibility to l5.0 for lists() method.
- Added Blade Template Extensions.
March 28, 2015
- Added Role Scope to get all users having a specific role. e.g
User::role('admin')->get();
will list all users havingadmin
role.
March 7, 2015
-
is()
andcan()
methods now support comma forAND
and pipe asOR
operator. Or pass an operator as a second param. more information - You can bind multiple permissions together so they inherit ones permission. more information
Contribution Guidelines
Support follows PSR-2 PHP coding standards, and semantic versioning.
Please report any issue you find in the issues page. Pull requests are welcome.
最近版本更新:(数据更新于 2024-09-18 05:30:42)
2024-08-19 08:34:15 2.0.9
2023-03-03 07:34:23 2.0.8
2022-02-27 12:01:27 2.0.7
2020-11-25 13:39:33 2.0.6
2020-05-15 01:51:16 2.0.5
2020-04-01 08:49:51 2.0.4
2019-11-15 06:27:22 2.0.3
2019-09-28 09:07:57 1.0.0
2019-09-28 09:07:22 2.0.2
2015-03-17 13:04:59 v0.1.3
kodeine/laravel-acl同语言 PHP最近更新仓库
2024-12-13 19:38:03 coollabsio/coolify
2024-12-13 09:22:46 w7corp/easywechat
2024-12-11 20:15:22 symfony/symfony
2024-11-29 16:49:37 symfony/var-dumper
2024-11-20 23:58:25 laravel/framework
2024-11-20 18:39:23 danielmiessler/SecLists