- Update or add the
versionandhandlemethods in yourApp\Http\Middleware\HandleInertiaRequestsmiddleware. - Add the middleware to the
$routeMiddlewarein yourApp\Http\Kernel.
Depending on your setup you might not want add the HandleInertiaRequests middelware directly to the web middleware stack.
Now you can add the middleware where needed and set the root template with inertia:[view].
class RouteServiceProvider extends ServiceProvider
{
public function boot()
{
$this->routes(function () {
Route::middleware('web', 'inertia')
->group(base_path('routes/web.php'));
Route::middleware('web', 'inertia:admin', 'auth')
->group(base_path('routes/admin.php'));
});
}
}
change HandleInertiaRequests.php line 56
laravel 11 bootstrap/app.php
thanks