Level 75
In this case they are same, Route::view is new in laravel so with closure it's just from old version of laravel. And it's just for example.
1 like
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
As you know using route closures prevents caching, and it always bothered me why does Laravel include the following route by default (which prevents route caching):
Route::get('/', function () {
return view('welcome');
});
Instead of simply using:
Route::view('/', 'welcome');
Is there a downside to using the second method? or are they the same?
I know I can simply edit it, but just want to know if there is a specific reason for this.
In this case they are same, Route::view is new in laravel so with closure it's just from old version of laravel. And it's just for example.
Please or to participate in this conversation.