auth.php 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. <?php
  2. /**
  3. * Created by PhpStorm.
  4. * User: hony
  5. * Date: 2018/1/19
  6. * Time: 14:35
  7. */
  8. return [
  9. /*
  10. |--------------------------------------------------------------------------
  11. | Authentication Defaults
  12. |--------------------------------------------------------------------------
  13. |
  14. | This option controls the default authentication "guard" and password
  15. | reset options for your application. You may change these defaults
  16. | as required, but they're a perfect start for most applications.
  17. |
  18. */
  19. 'defaults' => [
  20. 'guard' => 'api',
  21. 'passwords' => 'users',
  22. ],
  23. /*
  24. |--------------------------------------------------------------------------
  25. | Authentication Guards
  26. |--------------------------------------------------------------------------
  27. |
  28. | Next, you may define every authentication guard for your application.
  29. | Of course, a great default configuration has been defined for you
  30. | here which uses session storage and the Eloquent user provider.
  31. |
  32. | All authentication drivers have a user provider. This defines how the
  33. | users are actually retrieved out of your database or other storage
  34. | mechanisms used by this application to persist your user's data.
  35. |
  36. | Supported: "session", "token"
  37. |
  38. */
  39. 'guards' => [
  40. 'api' => [
  41. 'driver' => 'jwt',
  42. 'provider' => 'users',
  43. ],
  44. 'admin' => [
  45. 'driver' => 'jwt',
  46. 'provider' => 'admins',
  47. ]
  48. ],
  49. 'providers' => [
  50. 'users' => [
  51. 'driver' => 'eloquent',//这里是因为我用的mysql做的测试
  52. 'model' => App\Models\User::class,
  53. ],
  54. 'admins' => [
  55. 'driver' => 'eloquent',
  56. 'model' => App\Models\Admin::class,
  57. ],
  58. ],
  59. ];