laravel / sanctum

Laravel Sanctum provides a featherweight authentication system for SPAs and simple APIs.
https://laravel.com/docs/sanctum
MIT License
2.75k stars 296 forks source link

Directly assign a guard to the sanctum #525

Closed lanrenbulan closed 3 months ago

lanrenbulan commented 3 months ago

Guards

Routes

// How to guard with only admin
Route::middleware(['auth:sanctum'])

like:
Route::middleware(['auth:sanctum:admin']) // Equivalent to config(['sanctum.gurd' => ['admin']])

// How to guard with only customer
Route::middleware(['auth:sanctum']) 

like:
Route::middleware(['auth:sanctum:customer']) // Equivalent to config(['sanctum.gurd' => ['customer']])