repository.php 7.7 KB

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