Update to new Inertia::share() callback
This commit is contained in:
parent
f61d969aa5
commit
a18f643b22
|
@ -28,30 +28,31 @@ class AppServiceProvider extends ServiceProvider
|
||||||
Inertia::version(function () {
|
Inertia::version(function () {
|
||||||
return md5_file(public_path('mix-manifest.json'));
|
return md5_file(public_path('mix-manifest.json'));
|
||||||
});
|
});
|
||||||
Inertia::share('app.name', Config::get('app.name'));
|
|
||||||
Inertia::share('flash', function () {
|
Inertia::share(function () {
|
||||||
return [
|
return [
|
||||||
'success' => Session::get('success'),
|
'app' => [
|
||||||
|
'name' => Config::get('app.name'),
|
||||||
|
],
|
||||||
|
'auth' => [
|
||||||
|
'user' => Auth::user() ? [
|
||||||
|
'id' => Auth::user()->id,
|
||||||
|
'first_name' => Auth::user()->first_name,
|
||||||
|
'last_name' => Auth::user()->last_name,
|
||||||
|
'email' => Auth::user()->email,
|
||||||
|
'role' => Auth::user()->role,
|
||||||
|
'account' => [
|
||||||
|
'id' => Auth::user()->account->id,
|
||||||
|
'name' => Auth::user()->account->name,
|
||||||
|
],
|
||||||
|
] : null,
|
||||||
|
],
|
||||||
|
'flash' => [
|
||||||
|
'success' => Session::get('success'),
|
||||||
|
],
|
||||||
|
'errors' => Session::get('errors') ? Session::get('errors')->getBag('default')->getMessages() : (object) [],
|
||||||
];
|
];
|
||||||
});
|
});
|
||||||
Inertia::share('errors', function () {
|
|
||||||
return Session::get('errors') ? Session::get('errors')->getBag('default')->getMessages() : (object) [];
|
|
||||||
});
|
|
||||||
Inertia::share('auth.user', function () {
|
|
||||||
if (Auth::user()) {
|
|
||||||
return [
|
|
||||||
'id' => Auth::user()->id,
|
|
||||||
'first_name' => Auth::user()->first_name,
|
|
||||||
'last_name' => Auth::user()->last_name,
|
|
||||||
'email' => Auth::user()->email,
|
|
||||||
'role' => Auth::user()->role,
|
|
||||||
'account' => [
|
|
||||||
'id' => Auth::user()->account->id,
|
|
||||||
'name' => Auth::user()->account->name,
|
|
||||||
],
|
|
||||||
];
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
$this->registerLengthAwarePaginator();
|
$this->registerLengthAwarePaginator();
|
||||||
$this->registerCarbonMarcos();
|
$this->registerCarbonMarcos();
|
||||||
|
|
|
@ -216,16 +216,16 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "egulias/email-validator",
|
"name": "egulias/email-validator",
|
||||||
"version": "2.1.7",
|
"version": "2.1.8",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/egulias/EmailValidator.git",
|
"url": "https://github.com/egulias/EmailValidator.git",
|
||||||
"reference": "709f21f92707308cdf8f9bcfa1af4cb26586521e"
|
"reference": "c26463ff9241f27907112fbcd0c86fa670cfef98"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/709f21f92707308cdf8f9bcfa1af4cb26586521e",
|
"url": "https://api.github.com/repos/egulias/EmailValidator/zipball/c26463ff9241f27907112fbcd0c86fa670cfef98",
|
||||||
"reference": "709f21f92707308cdf8f9bcfa1af4cb26586521e",
|
"reference": "c26463ff9241f27907112fbcd0c86fa670cfef98",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
|
@ -269,7 +269,7 @@
|
||||||
"validation",
|
"validation",
|
||||||
"validator"
|
"validator"
|
||||||
],
|
],
|
||||||
"time": "2018-12-04T22:38:24+00:00"
|
"time": "2019-05-16T22:02:54+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "erusev/parsedown",
|
"name": "erusev/parsedown",
|
||||||
|
@ -427,12 +427,12 @@
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/inertiajs/inertia-laravel.git",
|
"url": "https://github.com/inertiajs/inertia-laravel.git",
|
||||||
"reference": "1c9acd0f69587013c2c24889f6b67ef0c31e0233"
|
"reference": "cb019592946bc939f61291039b8e893da66dd6eb"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/inertiajs/inertia-laravel/zipball/1c9acd0f69587013c2c24889f6b67ef0c31e0233",
|
"url": "https://api.github.com/repos/inertiajs/inertia-laravel/zipball/cb019592946bc939f61291039b8e893da66dd6eb",
|
||||||
"reference": "1c9acd0f69587013c2c24889f6b67ef0c31e0233",
|
"reference": "cb019592946bc939f61291039b8e893da66dd6eb",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
@ -467,7 +467,7 @@
|
||||||
"inertia",
|
"inertia",
|
||||||
"laravel"
|
"laravel"
|
||||||
],
|
],
|
||||||
"time": "2019-05-21T19:24:05+00:00"
|
"time": "2019-05-22T11:08:52+00:00"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "jakub-onderka/php-console-color",
|
"name": "jakub-onderka/php-console-color",
|
||||||
|
@ -2268,7 +2268,7 @@
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "Gert de Pagter",
|
"name": "Gert de Pagter",
|
||||||
"email": "backendtea@gmail.com"
|
"email": "BackEndTea@gmail.com"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"description": "Symfony polyfill for ctype functions",
|
"description": "Symfony polyfill for ctype functions",
|
||||||
|
|
Loading…
Reference in New Issue