Slide 59
Slide 59 text
NFNPTDPQF
// kernel
'scopes' => \Laravel\Passport\Http\Middleware\CheckScopes::class,
'scope' => \Laravel\Passport\Http\Middleware\CheckForAnyScope::class,
// router
Route::get('/orders', function () {
// ΞΫηετʔΫϯ"check-status"ͱ"place-orders"ɺ྆είʔϓΛ͍࣋ͬͯΔ
})->middleware('scopes:check-status,place-orders');
Route::get('/orders', function () {
// ΞΫηετʔΫϯɺ"check-status"͔"place-orders"ɺͲͪΒ͔ͷείʔϓΛ͍࣋ͬͯΔ
})->middleware('scope:check-status,place-orders');
Route::get('/orders', function (Request $request) {
if ($request->user()->tokenCan('place-orders')) {
//
}
});