Stateful APIのMiddleware順序を調整

This commit is contained in:
shibafu 2020-08-23 16:56:35 +09:00
parent 3406b326f0
commit 5fc8a22cca
2 changed files with 4 additions and 1 deletions

View File

@ -48,6 +48,8 @@ class Kernel extends HttpKernel
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class, \Illuminate\Session\Middleware\StartSession::class,
\App\Http\Middleware\VerifyCsrfToken::class, \App\Http\Middleware\VerifyCsrfToken::class,
'throttle:60,1',
'auth',
] ]
]; ];
@ -79,6 +81,7 @@ class Kernel extends HttpKernel
* @var array * @var array
*/ */
protected $middlewarePriority = [ protected $middlewarePriority = [
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Session\Middleware\StartSession::class, \Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class, \Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\Authenticate::class, \App\Http\Middleware\Authenticate::class,

View File

@ -18,7 +18,7 @@
Route::get('/checkin/card', 'Api\\CardController@show') Route::get('/checkin/card', 'Api\\CardController@show')
->middleware('throttle:180,1,card'); ->middleware('throttle:180,1,card');
Route::middleware(['throttle:60,1', 'stateful', 'auth'])->group(function () { Route::middleware('stateful')->group(function () {
Route::post('/likes', 'Api\\LikeController@store'); Route::post('/likes', 'Api\\LikeController@store');
Route::delete('/likes/{id}', 'Api\\LikeController@destroy'); Route::delete('/likes/{id}', 'Api\\LikeController@destroy');
}); });