repository.php 9.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291
  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' => 10080,
  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. 'created' => true,
  97. 'updated' => true,
  98. 'deleted' => 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. 'repositories' => [
  133. 'Webkul\Core\Repositories\CoreConfigRepository' => [
  134. 'enabled' => true,
  135. // 'minutes' => 10080,
  136. // 'clean' => [
  137. // 'enabled' => true,
  138. // 'on' => [
  139. // 'created' => true,
  140. // 'updated' => true,
  141. // 'deleted' => true,
  142. // ]
  143. // ],
  144. // 'allowed' => [
  145. // 'only' => null,
  146. // 'except' => null
  147. // ],
  148. ],
  149. 'Webkul\Core\Repositories\ChannelRepository' => [
  150. 'enabled' => true,
  151. ],
  152. 'Webkul\Core\Repositories\CountryRepository' => [
  153. 'enabled' => true,
  154. ],
  155. 'Webkul\Core\Repositories\CountryStateRepository' => [
  156. 'enabled' => true,
  157. ],
  158. 'Webkul\Core\Repositories\CurrencyRepository' => [
  159. 'enabled' => true,
  160. ],
  161. 'Webkul\Core\Repositories\LocaleRepository' => [
  162. 'enabled' => true,
  163. ],
  164. ],
  165. ],
  166. /*
  167. |--------------------------------------------------------------------------
  168. | Criteria Config
  169. |--------------------------------------------------------------------------
  170. |
  171. | Settings of request parameters names that will be used by Criteria
  172. |
  173. */
  174. 'criteria' => [
  175. /*
  176. |--------------------------------------------------------------------------
  177. | Accepted Conditions
  178. |--------------------------------------------------------------------------
  179. |
  180. | Conditions accepted in consultations where the Criteria
  181. |
  182. | Ex:
  183. |
  184. | 'acceptedConditions'=>['=','like']
  185. |
  186. | $query->where('foo','=','bar')
  187. | $query->where('foo','like','bar')
  188. |
  189. */
  190. 'acceptedConditions' => [
  191. '=',
  192. 'like',
  193. 'in',
  194. ],
  195. /*
  196. |--------------------------------------------------------------------------
  197. | Request Params
  198. |--------------------------------------------------------------------------
  199. |
  200. | Request parameters that will be used to filter the query in the repository
  201. |
  202. | Params :
  203. |
  204. | - search : Searched value
  205. | Ex: http://prettus.local/?search=lorem
  206. |
  207. | - searchFields : Fields in which research should be carried out
  208. | Ex:
  209. | http://prettus.local/?search=lorem&searchFields=name;email
  210. | http://prettus.local/?search=lorem&searchFields=name:like;email
  211. | http://prettus.local/?search=lorem&searchFields=name:like
  212. |
  213. | - filter : Fields that must be returned to the response object
  214. | Ex:
  215. | http://prettus.local/?search=lorem&filter=id,name
  216. |
  217. | - orderBy : Order By
  218. | Ex:
  219. | http://prettus.local/?search=lorem&orderBy=id
  220. |
  221. | - sortedBy : Sort
  222. | Ex:
  223. | http://prettus.local/?search=lorem&orderBy=id&sortedBy=asc
  224. | http://prettus.local/?search=lorem&orderBy=id&sortedBy=desc
  225. |
  226. | - searchJoin: Specifies the search method (AND / OR), by default the
  227. | application searches each parameter with OR
  228. | EX:
  229. | http://prettus.local/?search=lorem&searchJoin=and
  230. | http://prettus.local/?search=lorem&searchJoin=or
  231. |
  232. */
  233. 'params' => [
  234. 'search' => 'search',
  235. 'searchFields' => 'searchFields',
  236. 'filter' => 'filter',
  237. 'orderBy' => 'orderBy',
  238. 'sortedBy' => 'sortedBy',
  239. 'with' => 'with',
  240. 'searchJoin' => 'searchJoin',
  241. 'withCount' => 'withCount',
  242. ],
  243. ],
  244. /*
  245. |--------------------------------------------------------------------------
  246. | Generator Config
  247. |--------------------------------------------------------------------------
  248. |
  249. */
  250. 'generator' => [
  251. 'basePath' => app()->path(),
  252. 'rootNamespace' => 'App\\',
  253. 'stubsOverridePath' => app()->path(),
  254. 'paths' => [
  255. 'models' => 'Entities',
  256. 'repositories' => 'Repositories',
  257. 'interfaces' => 'Repositories',
  258. 'transformers' => 'Transformers',
  259. 'presenters' => 'Presenters',
  260. 'validators' => 'Validators',
  261. 'controllers' => 'Http/Controllers',
  262. 'provider' => 'RepositoryServiceProvider',
  263. 'criteria' => 'Criteria',
  264. ],
  265. ],
  266. ];