LaravelDaily / Test-Laravel-Routes

132 stars 1.06k forks source link

9 test #619

Open MambetniyazovAmir opened 2 years ago

MambetniyazovAmir commented 2 years ago

There was 1 failure:

1) Tests\Feature\RoutesTest::test_is_admin_middleware_is_working Expected response status code [201, 301, 302, 303, 307, 308] but received 500.

The following exception occurred during the request:

ErrorException: Attempt to read property "is_admin" on null in /home/runner/work/Test-Laravel-Routes/Test-Laravel-Routes/app/Http/Middleware/IsAdminMiddleware.php:19

Route::middleware('is_admin')->prefix('admin')->group(function () { .................. }

tibix commented 6 months ago

That is not the correct way to have prefix and middleware. You need to use Route::group(['prefix'=>'admin', 'middleware'...