You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to install this on Laravel 10, but the instructions don't match
When I want to run this on specific pages, the instructions say to first open "app/Http/Kernel.php" and then "...you should instead add a new mapping to the routeMiddleware array", but there's no such array in that Kernel-file. I can find one in another Kernel.php, where there's an empty array. Should it be added there instead?
Web.php seems to have a different format in Laravel 10 than last time I played around with Laravel, now a route in "web.php" looks like this: Route::get('/', function () { return view('index'); });
According to the docs, the way to do this would be: Route::middleware('page-cache')->get('/', 'PostController@index');
But that is not working. [Perhaps the issue here is that I implemented the middleware incorrectly in 1)]
Thanks!
The text was updated successfully, but these errors were encountered:
Web.php seems to have a different format in Laravel 10 than last time I played around with Laravel
Both of these syntaxes are valid:
// This uses an inline function to handle the route:
Route::middleware('page-cache')->get('/', function () {
returnview('index');
});
// This uses a controller method to handle the route:
Route::middleware('page-cache')->get('/', 'PostController@index');
I tried to install this on Laravel 10, but the instructions don't match
When I want to run this on specific pages, the instructions say to first open "app/Http/Kernel.php" and then "...you should instead add a new mapping to the routeMiddleware array", but there's no such array in that Kernel-file. I can find one in another Kernel.php, where there's an empty array. Should it be added there instead?
Web.php seems to have a different format in Laravel 10 than last time I played around with Laravel, now a route in "web.php" looks like this: Route::get('/', function () { return view('index'); });
According to the docs, the way to do this would be: Route::middleware('page-cache')->get('/', 'PostController@index');
But that is not working. [Perhaps the issue here is that I implemented the middleware incorrectly in 1)]
Thanks!
The text was updated successfully, but these errors were encountered: