A bare bones front-end for knockout designed for maximum compatibility with "obsolete" browsers
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 line
1023B

  1. <?php
  2. namespace App\Providers;
  3. use App\Models\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. }