juliocosta / lara-auth
Sanctum Auth ACL
Installs: 9
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/juliocosta/lara-auth
Requires
- php: ^7.2
- fruitcake/laravel-cors: ^1.0
- illuminate/support: ^6.0|^7.0
- laravel/sanctum: ^2.0
- laravel/tinker: ^2.0
This package is auto-updated.
Last update: 2025-10-09 14:58:08 UTC
README
Sacuntum Auth ACL is a Laravel package to authentication and authorization package.
The middleware has.acl check if auth user is authorized to access the route and he is authorized when has permission with
the same name of the route within any role he has
Install
- Install packaqe with composer
composer require juliocosta/lara-auth - Publish seeder
php artisan vendor:publish --force --tag auth-seeds - Add
has.aclon routes with that you wish check permissions - Run php artisan vendor:publish --provider="Laravel\Sanctum\SanctumServiceProvider"
- Run php artisan migrate
- Run
php artisan db:seed --class=PermissionsTableSeederto populate permissions table
Use
- Add Sanctum's middleware to your api middleware group within your app/Http/Kernel.php file:
cUrl
use Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful; 'api' => [ EnsureFrontendRequestsAreStateful::class, 'throttle:60,1', \Illuminate\Routing\Middleware\SubstituteBindings::class, ],
- Add trait in User model
use Laravel\Sanctum\HasApiTokens; class User extends Authenticatable { use HasApiTokens, Notifiable; }