I'm currently using the Spatie permission package, but I'm a bit confused what guard should I use since I'm using sanctum to authenticate the users. Should I use web? or api? or sanctum?
you can use the api guard if you have configured the api guard with sanctum driver in auth.php
'guards' => [
'web' => [
'driver' => 'session',
'provider' => 'admins',
],
'api' => [
'driver' => 'sanctum',
'provider' => 'users',
]
],
and in api.php you can group them with
Route::group(['middleware' => ['auth:api']], function () {
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With