function () use ($request) { return [ 'user' => $request->user() ? [ 'id' => $request->user()->id, 'first_name' => $request->user()->first_name, 'last_name' => $request->user()->last_name, 'email' => $request->user()->email, 'owner' => $request->user()->owner, 'account' => [ 'id' => $request->user()->account->id, 'name' => $request->user()->account->name, ], ] : null, ]; }, 'flash' => function () use ($request) { return [ 'success' => $request->session()->get('success'), 'error' => $request->session()->get('error'), ]; }, ]); } }