You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

249 lines
7.8 KiB

1 month ago
  1. <?php
  2. /*
  3. |--------------------------------------------------------------------------
  4. | Prettus Repository Config
  5. |--------------------------------------------------------------------------
  6. |
  7. |
  8. */
  9. return [
  10. /*
  11. |--------------------------------------------------------------------------
  12. | Repository Pagination Limit Default
  13. |--------------------------------------------------------------------------
  14. |
  15. */
  16. 'pagination' => [
  17. 'limit' => 15
  18. ],
  19. /*
  20. |--------------------------------------------------------------------------
  21. | Fractal Presenter Config
  22. |--------------------------------------------------------------------------
  23. |
  24. Available serializers:
  25. ArraySerializer
  26. DataArraySerializer
  27. JsonApiSerializer
  28. */
  29. 'fractal' => [
  30. 'params' => [
  31. 'include' => 'include'
  32. ],
  33. 'serializer' => League\Fractal\Serializer\DataArraySerializer::class
  34. ],
  35. /*
  36. |--------------------------------------------------------------------------
  37. | Cache Config
  38. |--------------------------------------------------------------------------
  39. |
  40. */
  41. 'cache' => [
  42. /*
  43. |--------------------------------------------------------------------------
  44. | Cache Status
  45. |--------------------------------------------------------------------------
  46. |
  47. | Enable or disable cache
  48. |
  49. */
  50. 'enabled' => false,
  51. /*
  52. |--------------------------------------------------------------------------
  53. | Cache Minutes
  54. |--------------------------------------------------------------------------
  55. |
  56. | Time of expiration cache
  57. |
  58. */
  59. 'minutes' => 30,
  60. /*
  61. |--------------------------------------------------------------------------
  62. | Cache Repository
  63. |--------------------------------------------------------------------------
  64. |
  65. | Instance of Illuminate\Contracts\Cache\Repository
  66. |
  67. */
  68. 'repository' => 'cache',
  69. /*
  70. |--------------------------------------------------------------------------
  71. | Cache Clean Listener
  72. |--------------------------------------------------------------------------
  73. |
  74. |
  75. |
  76. */
  77. 'clean' => [
  78. /*
  79. |--------------------------------------------------------------------------
  80. | Enable clear cache on repository changes
  81. |--------------------------------------------------------------------------
  82. |
  83. */
  84. 'enabled' => true,
  85. /*
  86. |--------------------------------------------------------------------------
  87. | Actions in Repository
  88. |--------------------------------------------------------------------------
  89. |
  90. | create : Clear Cache on create Entry in repository
  91. | update : Clear Cache on update Entry in repository
  92. | delete : Clear Cache on delete Entry in repository
  93. |
  94. */
  95. 'on' => [
  96. 'create' => true,
  97. 'update' => true,
  98. 'delete' => true,
  99. ]
  100. ],
  101. 'params' => [
  102. /*
  103. |--------------------------------------------------------------------------
  104. | Skip Cache Params
  105. |--------------------------------------------------------------------------
  106. |
  107. |
  108. | Ex: http://prettus.local/?search=lorem&skipCache=true
  109. |
  110. */
  111. 'skipCache' => 'skipCache'
  112. ],
  113. /*
  114. |--------------------------------------------------------------------------
  115. | Methods Allowed
  116. |--------------------------------------------------------------------------
  117. |
  118. | methods cacheable : all, paginate, find, findByField, findWhere, getByCriteria
  119. |
  120. | Ex:
  121. |
  122. | 'only' =>['all','paginate'],
  123. |
  124. | or
  125. |
  126. | 'except' =>['find'],
  127. */
  128. 'allowed' => [
  129. 'only' => null,
  130. 'except' => null
  131. ]
  132. ],
  133. /*
  134. |--------------------------------------------------------------------------
  135. | Criteria Config
  136. |--------------------------------------------------------------------------
  137. |
  138. | Settings of request parameters names that will be used by Criteria
  139. |
  140. */
  141. 'criteria' => [
  142. /*
  143. |--------------------------------------------------------------------------
  144. | Accepted Conditions
  145. |--------------------------------------------------------------------------
  146. |
  147. | Conditions accepted in consultations where the Criteria
  148. |
  149. | Ex:
  150. |
  151. | 'acceptedConditions'=>['=','like']
  152. |
  153. | $query->where('foo','=','bar')
  154. | $query->where('foo','like','bar')
  155. |
  156. */
  157. 'acceptedConditions' => [
  158. '=',
  159. 'like',
  160. 'in',
  161. '>=',
  162. '<=',
  163. 'between'
  164. ],
  165. /*
  166. |--------------------------------------------------------------------------
  167. | Request Params
  168. |--------------------------------------------------------------------------
  169. |
  170. | Request parameters that will be used to filter the query in the repository
  171. |
  172. | Params :
  173. |
  174. | - search : Searched value
  175. | Ex: http://prettus.local/?search=lorem
  176. |
  177. | - searchFields : Fields in which research should be carried out
  178. | Ex:
  179. | http://prettus.local/?search=lorem&searchFields=name;email
  180. | http://prettus.local/?search=lorem&searchFields=name:like;email
  181. | http://prettus.local/?search=lorem&searchFields=name:like
  182. |
  183. | - filter : Fields that must be returned to the response object
  184. | Ex:
  185. | http://prettus.local/?search=lorem&filter=id,name
  186. |
  187. | - orderBy : Order By
  188. | Ex:
  189. | http://prettus.local/?search=lorem&orderBy=id
  190. |
  191. | - sortedBy : Sort
  192. | Ex:
  193. | http://prettus.local/?search=lorem&orderBy=id&sortedBy=asc
  194. | http://prettus.local/?search=lorem&orderBy=id&sortedBy=desc
  195. |
  196. | - searchJoin: Specifies the search method (AND / OR), by default the
  197. | application searches each parameter with OR
  198. | EX:
  199. | http://prettus.local/?search=lorem&searchJoin=and
  200. | http://prettus.local/?search=lorem&searchJoin=or
  201. |
  202. */
  203. 'params' => [
  204. 'search' => 'search',
  205. 'searchFields' => 'searchFields',
  206. 'filter' => 'filter',
  207. 'orderBy' => 'orderBy',
  208. 'sortedBy' => 'sortedBy',
  209. 'with' => 'with',
  210. 'searchJoin' => 'searchJoin',
  211. 'withCount' => 'withCount'
  212. ]
  213. ],
  214. /*
  215. |--------------------------------------------------------------------------
  216. | Generator Config
  217. |--------------------------------------------------------------------------
  218. |
  219. */
  220. 'generator' => [
  221. 'basePath' => app()->path(),
  222. 'rootNamespace' => 'App\\',
  223. 'stubsOverridePath' => app()->path(),
  224. 'paths' => [
  225. 'models' => 'Entities',
  226. 'repositories' => 'Repositories',
  227. 'interfaces' => 'Repositories',
  228. 'transformers' => 'Transformers',
  229. 'presenters' => 'Presenters',
  230. 'validators' => 'Validators',
  231. 'controllers' => 'Http/Controllers',
  232. 'provider' => 'RepositoryServiceProvider',
  233. 'criteria' => 'Criteria'
  234. ]
  235. ]
  236. ];