Home > database >  Laravel 8 'Route [admin.test] not defined'
Laravel 8 'Route [admin.test] not defined'

Time:01-27

I'm trying to write a new route, but it doesn't work. Even this route is not shown in the route:list. But if i write route:cache, this route is working. It's annoying for each new route, how to solve them ?

    Route::group(['prefix' => 'admin', 'middleware' => 'auth', 'as' => 'admin.'], function () {
        Route::get('/test', [AdminIndexController::class, 'index'])->name('test');  
});

in blade.php

<a href="{{ route('admin.test') }}">Test</a>

CodePudding user response:

If you want to remove the routes cache , remove this file:

bootstrap/cache/routes.php

After that you can run artisan command

php artisan cache:clear

But There's no problem about not using route cache. It just can make "your route registration up to 100x faster" as noted in the documentation.

  •  Tags:  
  • Related