diff --git a/app/Http/Kernel.php b/app/Http/Kernel.php index 78169ad..6e96c70 100644 --- a/app/Http/Kernel.php +++ b/app/Http/Kernel.php @@ -4,6 +4,7 @@ namespace App\Http; +use App\Http\Middleware\ApiAfter; use App\Http\Middleware\Authenticate; use App\Http\Middleware\EncryptCookies; use App\Http\Middleware\PreventRequestsDuringMaintenance; @@ -50,6 +51,7 @@ final class Kernel extends HttpKernel 'api' => [ 'throttle:api', SubstituteBindings::class, + ApiAfter::class, ], ]; diff --git a/app/Http/Middleware/ApiAfter.php b/app/Http/Middleware/ApiAfter.php new file mode 100644 index 0000000..7d320ee --- /dev/null +++ b/app/Http/Middleware/ApiAfter.php @@ -0,0 +1,23 @@ + $request->user() ); +Route::get('/ping', fn(Request $request) => 'pong'); Route::post('/upload-files', [TestController::class, 'uploadFiles']); diff --git a/tests/Functional/MiddlewaresCest.php b/tests/Functional/MiddlewaresCest.php new file mode 100644 index 0000000..b466a6e --- /dev/null +++ b/tests/Functional/MiddlewaresCest.php @@ -0,0 +1,19 @@ +amOnPage('/api/ping'); + + Queue::assertPushed(SampleJob::class); + } +} \ No newline at end of file