permission.php 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  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 the package implements teams using the 'team_foreign_key'. If you want
  82. * the migrations to register the 'team_foreign_key', you must set this to true
  83. * before doing the migration. If you already did the migration then you must make a new
  84. * migration to also add 'team_foreign_key' to 'roles', 'model_has_roles', and
  85. * 'model_has_permissions'(view the latest version of package's migration file)
  86. */
  87. 'teams' => false,
  88. /*
  89. * When set to true, the required permission names are added to the exception
  90. * message. This could be considered an information leak in some contexts, so
  91. * the default setting is false here for optimum safety.
  92. */
  93. 'display_permission_in_exception' => false,
  94. /*
  95. * When set to true, the required role names are added to the exception
  96. * message. This could be considered an information leak in some contexts, so
  97. * the default setting is false here for optimum safety.
  98. */
  99. 'display_role_in_exception' => false,
  100. /*
  101. * By default wildcard permission lookups are disabled.
  102. */
  103. 'enable_wildcard_permission' => false,
  104. 'cache' => [
  105. /*
  106. * By default all permissions are cached for 24 hours to speed up performance.
  107. * When permissions or roles are updated the cache is flushed automatically.
  108. */
  109. 'expiration_time' => \DateInterval::createFromDateString('24 hours'),
  110. /*
  111. * The cache key used to store all permissions.
  112. */
  113. 'key' => 'spatie.permission.cache',
  114. /*
  115. * You may optionally indicate a specific cache driver to use for permission and
  116. * role caching using any of the `store` drivers listed in the cache.php config
  117. * file. Using 'default' here means to use the `default` set in cache.php.
  118. */
  119. 'store' => 'default',
  120. ],
  121. ];