AuthServiceProvider.php 1020 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. namespace App\Providers;
  3. use App\User;
  4. use Illuminate\Support\Facades\Gate;
  5. use Illuminate\Support\ServiceProvider;
  6. class AuthServiceProvider extends ServiceProvider
  7. {
  8. /**
  9. * Register any application services.
  10. *
  11. * @return void
  12. */
  13. public function register()
  14. {
  15. //
  16. }
  17. /**
  18. * Boot the authentication services for the application.
  19. *
  20. * @return void
  21. */
  22. public function boot()
  23. {
  24. // Here you may define how you wish users to be authenticated for your Lumen
  25. // application. The callback which receives the incoming request instance
  26. // should return either a User instance or null. You're free to obtain
  27. // the User instance via an API token or any other method necessary.
  28. /*$this->app['auth']->viaRequest('api', function ($request) {
  29. if ($request->input('api_token')) {
  30. return User::where('api_token', $request->input('api_token'))->first();
  31. }
  32. });*/
  33. }
  34. }