I have a standard resource controller registered like this:
Route::resource('/movies', \App\Http\Controllers\MovieController::class );
I checked php artisan route:list and I have the get 'movies' route.
But in blade template
<a href="{{ route('movies') }}" class="hover:text-gray-300">Movies</a>
does not work anymore.
And only
<a href="{{ url('movies') }}" class="hover:text-gray-300">Movies</a>
works.
Before that when I had:
Route::get('/movies', function () {
return view('movies');
})->name('movies');
The route method worked.
So url() method works everywhere and route() only in specific cases.
Could anyone tell me what is the main difference between those two methods?
which one should be used when?
And the main question - is it OK that the route() method does not work with resource controller, or is it something wrong with my code?
And since url() works everywhere should I just forget about route() method as unreliable?