<?phpnamespaceApp\Providers;useApp\User;useIlluminate\Support\Facades\Gate;useIlluminate\Support\ServiceProvider;classAuthServiceProviderextendsServiceProvider{/** * Register any application services. * * @return void */publicfunctionregister(){//}/** * Boot the authentication services for the application. * * @return void */publicfunctionboot(){// Here you may define how you wish users to be authenticated for your Lumen// application. The callback which receives the incoming request instance// should return either a User instance or null. You're free to obtain// the User instance via an API token or any other method necessary.$this->app['auth']->viaRequest('api',function($request){if($request->input('api_token')){returnUser::where('api_token',$request->input('api_token'))->first();}});}}