repository.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255
  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. |--------------------------------------------------------------------------
  164. | Request Params
  165. |--------------------------------------------------------------------------
  166. |
  167. | Request parameters that will be used to filter the query in the repository
  168. |
  169. | Params :
  170. |
  171. | - search : Searched value
  172. | Ex: http://prettus.local/?search=lorem
  173. |
  174. | - searchFields : Fields in which research should be carried out
  175. | Ex:
  176. | http://prettus.local/?search=lorem&searchFields=name;email
  177. | http://prettus.local/?search=lorem&searchFields=name:like;email
  178. | http://prettus.local/?search=lorem&searchFields=name:like
  179. |
  180. | - filter : Fields that must be returned to the response object
  181. | Ex:
  182. | http://prettus.local/?search=lorem&filter=id,name
  183. |
  184. | - orderBy : Order By
  185. | Ex:
  186. | http://prettus.local/?search=lorem&orderBy=id
  187. |
  188. | - sortedBy : Sort
  189. | Ex:
  190. | http://prettus.local/?search=lorem&orderBy=id&sortedBy=asc
  191. | http://prettus.local/?search=lorem&orderBy=id&sortedBy=desc
  192. |
  193. | - searchJoin: Specifies the search method (AND / OR), by default the
  194. | application searches each parameter with OR
  195. | EX:
  196. | http://prettus.local/?search=lorem&searchJoin=and
  197. | http://prettus.local/?search=lorem&searchJoin=or
  198. |
  199. */
  200. 'params' => [
  201. 'search' => 'search',
  202. 'searchFields' => 'searchFields',
  203. 'filter' => 'filter',
  204. 'orderBy' => 'orderBy',
  205. 'sortedBy' => 'sortedBy',
  206. 'with' => 'with',
  207. 'searchJoin' => 'searchJoin',
  208. 'withCount' => 'withCount'
  209. ]
  210. ],
  211. /*
  212. |--------------------------------------------------------------------------
  213. | Generator Config
  214. |--------------------------------------------------------------------------
  215. |
  216. */
  217. 'generator' => [
  218. 'basePath' => app()->path(),
  219. 'rootNamespace' => 'App\\',
  220. 'stubsOverridePath' => app()->path(),
  221. 'paths' => [
  222. // 'models' => 'Entities',
  223. // 'repositories' => 'Repositories',
  224. // 'interfaces' => 'Repositories',
  225. // 'transformers' => 'Transformers',
  226. // 'presenters' => 'Presenters',
  227. // 'validators' => 'Validators',
  228. // 'controllers' => 'Http/Controllers',
  229. // 'provider' => 'RepositoryServiceProvider',
  230. // 'criteria' => 'Criteria'
  231. 'models' => 'Models',
  232. 'repositories' => 'Repositories\\Eloquent',
  233. 'interfaces' => 'Contracts\\Repositories',
  234. 'transformers' => 'Repositories\\Transformers',
  235. 'presenters' => 'Repositories\\Presenters',
  236. 'validators' => 'Repositories\\Validators',
  237. 'controllers' => 'Http/Controllers',
  238. 'provider' => 'RepositoryServiceProvider',
  239. 'criteria' => 'Repositories\\Criteria'
  240. ]
  241. ]
  242. ];