// you could use the invokable flag so you don't use the index
php artisan make:controller PagesController --invokable
// and then use this route:
Route::get('/{any?}', App\Http\Controllers\PagesController::class)->where('any', '.*');
// it tells Laravel routing to respond to any route provided or nothing with the question mark "?" and responds with an invokable controller
public function __invoke()
{
return view('welcome');
}
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter