laratrust.php 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  1. <?php
  2. /**
  3. * This file is part of Laratrust,
  4. * a role & permission management solution for Laravel.
  5. *
  6. * @license MIT
  7. * @package Laratrust
  8. */
  9. use App\Shop\Employees\Employee;
  10. use App\Shop\Permissions\Permission;
  11. use App\Shop\Roles\Role;
  12. use App\Shop\Teams\Team;
  13. return [
  14. /*
  15. |--------------------------------------------------------------------------
  16. | Use MorphMap in relationships between models
  17. |--------------------------------------------------------------------------
  18. |
  19. | If true, the morphMap feature is going to be used. The array values that
  20. | are going to be used are the ones inside the 'user_models' array.
  21. |
  22. */
  23. 'use_morph_map' => false,
  24. /*
  25. |--------------------------------------------------------------------------
  26. | Use cache in the package
  27. |--------------------------------------------------------------------------
  28. |
  29. | Defines if Laratrust will use Laravel's Cache to cache the roles and permissions.
  30. |
  31. */
  32. 'use_cache' => false,
  33. /*
  34. |--------------------------------------------------------------------------
  35. | Use teams feature in the package
  36. |--------------------------------------------------------------------------
  37. |
  38. | Defines if Laratrust will use the teams feature.
  39. | Please check the docs to see what you need to do in case you have the package already configured.
  40. |
  41. */
  42. 'use_teams' => false,
  43. /*
  44. |--------------------------------------------------------------------------
  45. | Strict check for roles/permissions inside teams
  46. |--------------------------------------------------------------------------
  47. |
  48. | Determines if a strict check should be done when checking if a role or permission
  49. | is attached inside a team.
  50. | If it's false, when checking a role/permission without specifying the team,
  51. | it will check only if the user has attached that role/permission ignoring the team.
  52. |
  53. */
  54. 'teams_strict_check' => false,
  55. /*
  56. |--------------------------------------------------------------------------
  57. | Laratrust User Models
  58. |--------------------------------------------------------------------------
  59. |
  60. | This is the array that contains the information of the user models.
  61. | This information is used in the add-trait command, and for the roles and
  62. | permissions relationships with the possible user models.
  63. |
  64. | The key in the array is the name of the relationship inside the roles and permissions.
  65. |
  66. */
  67. 'user_models' => [
  68. 'users' => Employee::class,
  69. ],
  70. /*
  71. |--------------------------------------------------------------------------
  72. | Laratrust Models
  73. |--------------------------------------------------------------------------
  74. |
  75. | These are the models used by Laratrust to define the roles, permissions and teams.
  76. | If you want the Laratrust models to be in a different namespace or
  77. | to have a different name, you can do it here.
  78. |
  79. */
  80. 'models' => [
  81. /**
  82. * Role model
  83. */
  84. 'role' => Role::class,
  85. /**
  86. * Permission model
  87. */
  88. 'permission' => Permission::class,
  89. /**
  90. * Team model
  91. */
  92. 'team' => Team::class,
  93. ],
  94. /*
  95. |--------------------------------------------------------------------------
  96. | Laratrust Tables
  97. |--------------------------------------------------------------------------
  98. |
  99. | These are the tables used by Laratrust to store all the authorization data.
  100. |
  101. */
  102. 'tables' => [
  103. /**
  104. * Roles table.
  105. */
  106. 'roles' => 'roles',
  107. /**
  108. * Permissions table.
  109. */
  110. 'permissions' => 'permissions',
  111. /**
  112. * Teams table.
  113. */
  114. 'teams' => 'teams',
  115. /**
  116. * Role - User intermediate table.
  117. */
  118. 'role_user' => 'role_user',
  119. /**
  120. * Permission - User intermediate table.
  121. */
  122. 'permission_user' => 'permission_user',
  123. /**
  124. * Permission - Role intermediate table.
  125. */
  126. 'permission_role' => 'permission_role',
  127. ],
  128. /*
  129. |--------------------------------------------------------------------------
  130. | Laratrust Foreign Keys
  131. |--------------------------------------------------------------------------
  132. |
  133. | These are the foreign keys used by laratrust in the intermediate tables.
  134. |
  135. */
  136. 'foreign_keys' => [
  137. /**
  138. * User foreign key on Laratrust's role_user and permission_user tables.
  139. */
  140. 'user' => 'user_id',
  141. /**
  142. * Role foreign key on Laratrust's role_user and permission_role tables.
  143. */
  144. 'role' => 'role_id',
  145. /**
  146. * Role foreign key on Laratrust's permission_user and permission_role tables.
  147. */
  148. 'permission' => 'permission_id',
  149. /**
  150. * Role foreign key on Laratrust's role_user and permission_user tables.
  151. */
  152. 'team' => 'team_id',
  153. ],
  154. /*
  155. |--------------------------------------------------------------------------
  156. | Laratrust Middleware
  157. |--------------------------------------------------------------------------
  158. |
  159. | This configuration helps to customize the Laratrust middleware behavior.
  160. |
  161. */
  162. 'middleware' => [
  163. /**
  164. * Define if the laratrust middleware are registered automatically in the service provider
  165. */
  166. 'register' => true,
  167. /**
  168. * Method to be called in the middleware return case.
  169. * Available: abort|redirect
  170. */
  171. 'handling' => 'abort',
  172. /**
  173. * Parameter passed to the middleware_handling method
  174. */
  175. 'params' => '403',
  176. ],
  177. /*
  178. |--------------------------------------------------------------------------
  179. | Laratrust Magic 'can' Method
  180. |--------------------------------------------------------------------------
  181. |
  182. | Supported cases for the magic can method (Refer to the docs).
  183. | Available: camel_case|snake_case|kebab_case
  184. |
  185. */
  186. 'magic_can_method_case' => 'kebab_case',
  187. ];