inertiajs / inertia-laravel

The Laravel adapter for Inertia.js.
https://inertiajs.com
MIT License
1.99k stars 222 forks source link

Change the rootView from configuration #626

Closed hafijul233 closed 1 month ago

hafijul233 commented 1 month ago

ResponseFactory.php class defines the $rootView point to app.blade.php. I thought it would be easy to configure it. Anyone who publishes the config file can easily change it. ServiceProvider boot method workaround also has the same output. IMHO This way, it feels more neat.

image

NickSdot commented 1 month ago

Inertia intentionally did choose to be configured via middleware, instead of config. There are considerations (for other reasons) to go with a ServiceProvider instead.

However, you already can use Inertia::setRootView('custom.layout'); wherever you want. Like, globally in AppServiceProvider or for instance in a specific controller.

Personally, not sure if we really need yet another way to configure this.