Commit 0b6114dd by Jonathan Reinink

Setup Inertia version tracking

1 parent 46764b2e
......@@ -29,6 +29,7 @@ class Kernel extends HttpKernel
*/
protected $middlewareGroups = [
'web' => [
\Inertia\CheckInertiaVersion::class,
\App\Http\Middleware\EncryptCookies::class,
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
......
......@@ -25,6 +25,9 @@ class AppServiceProvider extends ServiceProvider
public function register()
{
Inertia::version(function () {
return md5_file(public_path('mix-manifest.json'));
});
Inertia::share('app.name', Config::get('app.name'));
Inertia::share('errors', function () {
return Session::get('errors') ? Session::get('errors')->getBag('default')->getMessages() : (object) [];
......
......@@ -11,8 +11,7 @@ let app = document.getElementById('app')
new Vue({
render: h => h(Inertia, {
props: {
component: app.dataset.component,
props: JSON.parse(app.dataset.props),
initialPage: JSON.parse(app.dataset.page),
resolveComponent: (component) => {
return import(`@/Pages/${component}`).then(module => module.default)
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!