'how to display a view on laravel 8 and not have a 404 NOT FOUND page?

I try to display a view but I get a 404 not found error, but my code seems correct

this is the route created

Route::get('talk',[\App\Http\Controllers\TalkController::class,'index'])->name('talk.index');

the controller

namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\View;
class TalkController extends Controller
{
    public function index(): view
{
   return view('talk');
}
}

here is what I got as a result enter image description here

need help please



Solution 1:[1]

I was Facing the Same Problem laravel Store cache and if you stop the serv and start it all over you will still see the 404 so its better to do :-

php artisan optimize 

php artisan optimize creates a compiled file of commonly used classes in order to reduce the amount of files that must be loaded on each request. The file is saved to, or overwrites, bootstrap/cache/compiled. php , which needs to be writable by the web server (PHP process).

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Samoul