permission.php 6.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  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' => Spatie\Permission\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. * Events will fire when a role or permission is assigned/unassigned:
  88. * \Spatie\Permission\Events\RoleAttached
  89. * \Spatie\Permission\Events\RoleDetached
  90. * \Spatie\Permission\Events\PermissionAttached
  91. * \Spatie\Permission\Events\PermissionDetached
  92. *
  93. * To enable, set to true, and then create listeners to watch these events.
  94. */
  95. 'events_enabled' => false,
  96. /*
  97. * Teams Feature.
  98. * When set to true the package implements teams using the 'team_foreign_key'.
  99. * If you want the migrations to register the 'team_foreign_key', you must
  100. * set this to true before doing the migration.
  101. * If you already did the migration then you must make a new migration to also
  102. * add 'team_foreign_key' to 'roles', 'model_has_roles', and 'model_has_permissions'
  103. * (view the latest version of this package's migration file)
  104. */
  105. 'teams' => false,
  106. /*
  107. * The class to use to resolve the permissions team id
  108. */
  109. 'team_resolver' => \Spatie\Permission\DefaultTeamResolver::class,
  110. /*
  111. * Passport Client Credentials Grant
  112. * When set to true the package will use Passports Client to check permissions
  113. */
  114. 'use_passport_client_credentials' => false,
  115. /*
  116. * When set to true, the required permission names are added to exception messages.
  117. * This could be considered an information leak in some contexts, so the default
  118. * setting is false here for optimum safety.
  119. */
  120. 'display_permission_in_exception' => false,
  121. /*
  122. * When set to true, the required role names are added to exception messages.
  123. * This could be considered an information leak in some contexts, so the default
  124. * setting is false here for optimum safety.
  125. */
  126. 'display_role_in_exception' => false,
  127. /*
  128. * By default wildcard permission lookups are disabled.
  129. * See documentation to understand supported syntax.
  130. */
  131. 'enable_wildcard_permission' => false,
  132. /*
  133. * The class to use for interpreting wildcard permissions.
  134. * If you need to modify delimiters, override the class and specify its name here.
  135. */
  136. // 'wildcard_permission' => Spatie\Permission\WildcardPermission::class,
  137. /* Cache-specific settings */
  138. 'cache' => [
  139. /*
  140. * By default all permissions are cached for 24 hours to speed up performance.
  141. * When permissions or roles are updated the cache is flushed automatically.
  142. */
  143. 'expiration_time' => \DateInterval::createFromDateString('24 hours'),
  144. /*
  145. * The cache key used to store all permissions.
  146. */
  147. 'key' => 'spatie.permission.cache',
  148. /*
  149. * You may optionally indicate a specific cache driver to use for permission and
  150. * role caching using any of the `store` drivers listed in the cache.php config
  151. * file. Using 'default' here means to use the `default` set in cache.php.
  152. */
  153. 'store' => 'default',
  154. ],
  155. ];