permission.php 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. <?php
  2. return [
  3. 'models' => [
  4. /*
  5. * When using the "HasPermissions" trait from this package, we need to know which
  6. * Eloquent model should be used to retrieve your permissions. Of course, it
  7. * is often just the "Permission" model but you may use whatever you like.
  8. *
  9. * The model you want to use as a Permission model needs to implement the
  10. * `Spatie\Permission\Contracts\Permission` contract.
  11. */
  12. 'permission' => Spatie\Permission\Models\Permission::class,
  13. /*
  14. * When using the "HasRoles" trait from this package, we need to know which
  15. * Eloquent model should be used to retrieve your roles. Of course, it
  16. * is often just the "Role" model but you may use whatever you like.
  17. *
  18. * The model you want to use as a Role model needs to implement the
  19. * `Spatie\Permission\Contracts\Role` contract.
  20. */
  21. 'role' => \App\Models\Role::class,
  22. ],
  23. 'table_names' => [
  24. /*
  25. * When using the "HasRoles" trait from this package, we need to know which
  26. * table should be used to retrieve your roles. We have chosen a basic
  27. * default value but you may easily change it to any table you like.
  28. */
  29. 'roles' => 'roles',
  30. /*
  31. * When using the "HasPermissions" trait from this package, we need to know which
  32. * table should be used to retrieve your permissions. We have chosen a basic
  33. * default value but you may easily change it to any table you like.
  34. */
  35. 'permissions' => 'permissions',
  36. /*
  37. * When using the "HasPermissions" trait from this package, we need to know which
  38. * table should be used to retrieve your models permissions. We have chosen a
  39. * basic default value but you may easily change it to any table you like.
  40. */
  41. 'model_has_permissions' => 'model_has_permissions',
  42. /*
  43. * When using the "HasRoles" trait from this package, we need to know which
  44. * table should be used to retrieve your models roles. We have chosen a
  45. * basic default value but you may easily change it to any table you like.
  46. */
  47. 'model_has_roles' => 'model_has_roles',
  48. /*
  49. * When using the "HasRoles" trait from this package, we need to know which
  50. * table should be used to retrieve your roles permissions. We have chosen a
  51. * basic default value but you may easily change it to any table you like.
  52. */
  53. 'role_has_permissions' => 'role_has_permissions',
  54. ],
  55. 'column_names' => [
  56. /*
  57. * Change this if you want to name the related pivots other than defaults
  58. */
  59. 'role_pivot_key' => null, //default 'role_id',
  60. 'permission_pivot_key' => null, //default 'permission_id',
  61. /*
  62. * Change this if you want to name the related model primary key other than
  63. * `model_id`.
  64. *
  65. * For example, this would be nice if your primary keys are all UUIDs. In
  66. * that case, name this `model_uuid`.
  67. */
  68. 'model_morph_key' => 'model_id',
  69. /*
  70. * Change this if you want to use the teams feature and your related model's
  71. * foreign key is other than `team_id`.
  72. */
  73. 'team_foreign_key' => 'team_id',
  74. ],
  75. /*
  76. * When set to true, the method for checking permissions will be registered on the gate.
  77. * Set this to false if you want to implement custom logic for checking permissions.
  78. */
  79. 'register_permission_check_method' => true,
  80. /*
  81. * When set to true, Laravel\Octane\Events\OperationTerminated event listener will be registered
  82. * this will refresh permissions on every TickTerminated, TaskTerminated and RequestTerminated
  83. * NOTE: This should not be needed in most cases, but an Octane/Vapor combination benefited from it.
  84. */
  85. 'register_octane_reset_listener' => false,
  86. /*
  87. * Teams Feature.
  88. * When set to true the package implements teams using the 'team_foreign_key'.
  89. * If you want the migrations to register the 'team_foreign_key', you must
  90. * set this to true before doing the migration.
  91. * If you already did the migration then you must make a new migration to also
  92. * add 'team_foreign_key' to 'roles', 'model_has_roles', and 'model_has_permissions'
  93. * (view the latest version of this package's migration file)
  94. */
  95. 'teams' => false,
  96. /*
  97. * Passport Client Credentials Grant
  98. * When set to true the package will use Passports Client to check permissions
  99. */
  100. 'use_passport_client_credentials' => false,
  101. /*
  102. * When set to true, the required permission names are added to exception messages.
  103. * This could be considered an information leak in some contexts, so the default
  104. * setting is false here for optimum safety.
  105. */
  106. 'display_permission_in_exception' => false,
  107. /*
  108. * When set to true, the required role names are added to exception messages.
  109. * This could be considered an information leak in some contexts, so the default
  110. * setting is false here for optimum safety.
  111. */
  112. 'display_role_in_exception' => false,
  113. /*
  114. * By default wildcard permission lookups are disabled.
  115. * See documentation to understand supported syntax.
  116. */
  117. 'enable_wildcard_permission' => false,
  118. /*
  119. * The class to use for interpreting wildcard permissions.
  120. * If you need to modify delimiters, override the class and specify its name here.
  121. */
  122. // 'permission.wildcard_permission' => Spatie\Permission\WildcardPermission::class,
  123. /* Cache-specific settings */
  124. 'cache' => [
  125. /*
  126. * By default all permissions are cached for 24 hours to speed up performance.
  127. * When permissions or roles are updated the cache is flushed automatically.
  128. */
  129. 'expiration_time' => \DateInterval::createFromDateString('24 hours'),
  130. /*
  131. * The cache key used to store all permissions.
  132. */
  133. 'key' => 'spatie.permission.cache',
  134. /*
  135. * You may optionally indicate a specific cache driver to use for permission and
  136. * role caching using any of the `store` drivers listed in the cache.php config
  137. * file. Using 'default' here means to use the `default` set in cache.php.
  138. */
  139. 'store' => 'default',
  140. ],
  141. ];