Skip to content
Advertisement

Why my route is not working perfectly in Laravel 8?

I am using Laravel 8 with fortify auth without Jetstream.

web.php

Route::get('/facade_version', function () {
    dd('EXAMPLE');
})->name('postcard.facade');

Above is my route

index.blade.php

<a href="{{ route('postcard.facade') }}" type="a" class="btn btn-success">facade postcard</a>

Output in Screen

Route [postcard.facade] not defined. (View: E:githubLARAVELlaravel8-fortifyresourcesviewsfacadeindex.blade.php)

I tried with second way using http://127.0.0.1:8000/facade_version in url

Output in Screen

404 | Not Found

Everything is ok But I could not figure it out whats the problem.

I have done this kind of route before with same way.

But this is not working

Look at the below route. it works perfectly.

Route::get('/post-cards', function () {
    $postcardService = new PostcardSendingService('USA', 4, 6);
    $postcardService->hello('Hello from Coder Tape USA!!', 'imrul.cse273@gmail.com');
})->name('postcard.index');

  • I just edit the link to /post-cardsss instead of /post-cards‘ then again the route is not found

Note

Today I ran these commands in my projects

php artisan config:clear
php artisan view:clear
php artisan cache:clear
php artisan route:cache
composer dump-autoload

Advertisement

Answer

Solved it using this command

php artisan route:clear

And run the project again

User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement