permission.php 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <?php
  2. /*
  3. * This file is part of the Jiannei/lumen-api-starter.
  4. *
  5. * (c) Jiannei <longjian.huang@foxmail.com>
  6. *
  7. * This source file is subject to the MIT license that is bundled
  8. * with this source code in the file LICENSE.
  9. */
  10. return [
  11. 'models' => [
  12. /*
  13. * When using the "HasPermissions" trait from this package, we need to know which
  14. * Eloquent model should be used to retrieve your permissions. Of course, it
  15. * is often just the "Permission" model but you may use whatever you like.
  16. *
  17. * The model you want to use as a Permission model needs to implement the
  18. * `Spatie\Permission\Contracts\Permission` contract.
  19. */
  20. 'permission' => Spatie\Permission\Models\Permission::class,
  21. /*
  22. * When using the "HasRoles" trait from this package, we need to know which
  23. * Eloquent model should be used to retrieve your roles. Of course, it
  24. * is often just the "Role" model but you may use whatever you like.
  25. *
  26. * The model you want to use as a Role model needs to implement the
  27. * `Spatie\Permission\Contracts\Role` contract.
  28. */
  29. // 'role' => Spatie\Permission\Models\Role::class,
  30. 'role' => \App\Repositories\Models\Base\Role::class,
  31. ],
  32. 'table_names' => [
  33. /*
  34. * When using the "HasRoles" trait from this package, we need to know which
  35. * table should be used to retrieve your roles. We have chosen a basic
  36. * default value but you may easily change it to any table you like.
  37. */
  38. 'roles' => 'base_roles',
  39. /*
  40. * When using the "HasPermissions" trait from this package, we need to know which
  41. * table should be used to retrieve your permissions. We have chosen a basic
  42. * default value but you may easily change it to any table you like.
  43. */
  44. 'permissions' => 'base_permissions',
  45. /*
  46. * When using the "HasPermissions" trait from this package, we need to know which
  47. * table should be used to retrieve your models permissions. We have chosen a
  48. * basic default value but you may easily change it to any table you like.
  49. */
  50. 'model_has_permissions' => 'base_model_has_permissions',
  51. /*
  52. * When using the "HasRoles" trait from this package, we need to know which
  53. * table should be used to retrieve your models roles. We have chosen a
  54. * basic default value but you may easily change it to any table you like.
  55. */
  56. 'model_has_roles' => 'base_model_has_roles',
  57. /*
  58. * When using the "HasRoles" trait from this package, we need to know which
  59. * table should be used to retrieve your roles permissions. We have chosen a
  60. * basic default value but you may easily change it to any table you like.
  61. */
  62. 'role_has_permissions' => 'base_role_has_permissions',
  63. ],
  64. 'column_names' => [
  65. /*
  66. * Change this if you want to name the related model primary key other than
  67. * `model_id`.
  68. *
  69. * For example, this would be nice if your primary keys are all UUIDs. In
  70. * that case, name this `model_uuid`.
  71. */
  72. 'model_morph_key' => 'model_id',
  73. ],
  74. /*
  75. * When set to true, the required permission names are added to the exception
  76. * message. This could be considered an information leak in some contexts, so
  77. * the default setting is false here for optimum safety.
  78. */
  79. 'display_permission_in_exception' => true,
  80. /*
  81. * When set to true, the required role names are added to the exception
  82. * message. This could be considered an information leak in some contexts, so
  83. * the default setting is false here for optimum safety.
  84. */
  85. 'display_role_in_exception' => true,
  86. /*
  87. * By default wildcard permission lookups are disabled.
  88. */
  89. 'enable_wildcard_permission' => false,
  90. 'cache' => [
  91. /*
  92. * By default all permissions are cached for 24 hours to speed up performance.
  93. * When permissions or roles are updated the cache is flushed automatically.
  94. */
  95. // 'expiration_time' => \DateInterval::createFromDateString('24 hours'),
  96. 'expiration_time' => \DateInterval::createFromDateString('1 hours'),
  97. /*
  98. * The cache key used to store all permissions.
  99. */
  100. 'key' => 'spatie.permission.cache',
  101. /*
  102. * When checking for a permission against a model by passing a Permission
  103. * instance to the check, this key determines what attribute on the
  104. * Permissions model is used to cache against.
  105. *
  106. * Ideally, this should match your preferred way of checking permissions, eg:
  107. * `$user->can('view-posts')` would be 'name'.
  108. */
  109. 'model_key' => 'name',
  110. /*
  111. * You may optionally indicate a specific cache driver to use for permission and
  112. * role caching using any of the `store` drivers listed in the cache.php config
  113. * file. Using 'default' here means to use the `default` set in cache.php.
  114. */
  115. 'store' => 'default',
  116. ],
  117. ];