'App\Policies\ModelPolicy', ]; /** * Register any authentication / authorization services. * * @return void */ public function boot() { $this->registerPolicies(); $this->app['request']->mixin(new RequestMixin); $this->app['request']->mixin(new BusinessInfoRequestMixin); $this->app['auth']->viaRequest('token', function ($request) { if ($request->bearerToken() === null) { return null; } $fingerprint = Fingerprint::where([ 'token' => $request->bearerToken(), 'agent' => $request->getAgent(), 'os' => $request->getOS(), ])->first(); return $fingerprint->user->setAttribute('token', $fingerprint->token); }); } }