repository.php 8.1 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. */
  17. 'pagination' => [
  18. 'limit' => 15
  19. ],
  20. /*
  21. |--------------------------------------------------------------------------
  22. | Fractal Presenter Config
  23. |--------------------------------------------------------------------------
  24. |
  25. Available serializers:
  26. ArraySerializer
  27. DataArraySerializer
  28. JsonApiSerializer
  29. */
  30. 'fractal' => [
  31. 'params' => [
  32. 'include' => 'include'
  33. ],
  34. 'serializer' => League\Fractal\Serializer\DataArraySerializer::class
  35. ],
  36. /*
  37. |--------------------------------------------------------------------------
  38. | Cache Config
  39. |--------------------------------------------------------------------------
  40. |
  41. */
  42. 'cache' => [
  43. /*
  44. |--------------------------------------------------------------------------
  45. | Cache Status
  46. |--------------------------------------------------------------------------
  47. |
  48. | Enable or disable cache
  49. |
  50. */
  51. 'enabled' => true,
  52. /*
  53. |--------------------------------------------------------------------------
  54. | Cache Minutes
  55. |--------------------------------------------------------------------------
  56. |
  57. | Time of expiration cache
  58. |
  59. */
  60. 'minutes' => 30,
  61. /*
  62. |--------------------------------------------------------------------------
  63. | Cache Repository
  64. |--------------------------------------------------------------------------
  65. |
  66. | Instance of Illuminate\Contracts\Cache\Repository
  67. |
  68. */
  69. 'repository' => 'cache',
  70. /*
  71. |--------------------------------------------------------------------------
  72. | Cache Clean Listener
  73. |--------------------------------------------------------------------------
  74. |
  75. |
  76. |
  77. */
  78. 'clean' => [
  79. /*
  80. |--------------------------------------------------------------------------
  81. | Enable clear cache on repository changes
  82. |--------------------------------------------------------------------------
  83. |
  84. */
  85. 'enabled' => true,
  86. /*
  87. |--------------------------------------------------------------------------
  88. | Actions in Repository
  89. |--------------------------------------------------------------------------
  90. |
  91. | create : Clear Cache on create Entry in repository
  92. | update : Clear Cache on update Entry in repository
  93. | delete : Clear Cache on delete Entry in repository
  94. |
  95. */
  96. 'on' => [
  97. 'create' => true,
  98. 'update' => true,
  99. 'delete' => true,
  100. ]
  101. ],
  102. 'params' => [
  103. /*
  104. |--------------------------------------------------------------------------
  105. | Skip Cache Params
  106. |--------------------------------------------------------------------------
  107. |
  108. |
  109. | Ex: http://prettus.local/?search=lorem&skipCache=true
  110. |
  111. */
  112. 'skipCache' => 'skipCache'
  113. ],
  114. /*
  115. |--------------------------------------------------------------------------
  116. | Methods Allowed
  117. |--------------------------------------------------------------------------
  118. |
  119. | methods cacheable : all, paginate, find, findByField, findWhere, getByCriteria
  120. |
  121. | Ex:
  122. |
  123. | 'only' =>['all','paginate'],
  124. |
  125. | or
  126. |
  127. | 'except' =>['find'],
  128. */
  129. 'allowed' => [
  130. 'only' => null,
  131. 'except' => null
  132. ]
  133. ],
  134. /*
  135. |--------------------------------------------------------------------------
  136. | Criteria Config
  137. | 过滤条件配置
  138. |--------------------------------------------------------------------------
  139. |
  140. | Settings of request parameters names that will be used by Criteria
  141. |
  142. */
  143. 'criteria' => [
  144. /*
  145. |--------------------------------------------------------------------------
  146. | Accepted Conditions
  147. |--------------------------------------------------------------------------
  148. |
  149. | Conditions accepted in consultations where the Criteria
  150. |
  151. | Ex:
  152. |
  153. | 'acceptedConditions'=>['=','like']
  154. |
  155. | $query->where('foo','=','bar')
  156. | $query->where('foo','like','bar')
  157. |
  158. */
  159. 'acceptedConditions' => [
  160. '=',
  161. 'like'
  162. ],
  163. /*
  164. |--------------------------------------------------------------------------
  165. | Request Params
  166. |--------------------------------------------------------------------------
  167. |
  168. | Request parameters that will be used to filter the query in the repository
  169. |
  170. | Params :
  171. |
  172. | - search : Searched value
  173. | Ex: http://prettus.local/?search=lorem
  174. |
  175. | - searchFields : Fields in which research should be carried out
  176. | Ex:
  177. | http://prettus.local/?search=lorem&searchFields=name;email
  178. | http://prettus.local/?search=lorem&searchFields=name:like;email
  179. | http://prettus.local/?search=lorem&searchFields=name:like
  180. |
  181. | - filter : Fields that must be returned to the response object
  182. | Ex:
  183. | http://prettus.local/?search=lorem&filter=id,name
  184. |
  185. | - orderBy : Order By
  186. | Ex:
  187. | http://prettus.local/?search=lorem&orderBy=id
  188. |
  189. | - sortedBy : Sort
  190. | Ex:
  191. | http://prettus.local/?search=lorem&orderBy=id&sortedBy=asc
  192. | http://prettus.local/?search=lorem&orderBy=id&sortedBy=desc
  193. |
  194. */
  195. 'params' => [
  196. 'search' => 'search',
  197. 'searchFields' => 'searchFields',
  198. 'filter' => 'filter',
  199. 'orderBy' => 'orderBy',
  200. 'sortedBy' => 'sortedBy',
  201. 'with' => 'with',
  202. 'searchJoin' => 'searchJoin',
  203. ]
  204. ],
  205. /*
  206. |--------------------------------------------------------------------------
  207. | Generator Config
  208. | 生成器 - 配置
  209. |--------------------------------------------------------------------------
  210. |
  211. */
  212. 'generator' => [
  213. 'basePath' => app_path(), //> generator绝对位置如C:\gtSoftware\WWW\blog\app
  214. 'rootNamespace' => 'App\\', //> generator根命名空间 App\\ 下
  215. //> 生成器 - paths 参数
  216. //> key => rootNamespace\\paths.value # 当前Class命名空间
  217. //> key => basePath/paths.value # 当前Class目录名称 basePath/paths
  218. 'paths' => [
  219. 'models' => 'Models', //> 模型 目录/命名空间
  220. 'repositories' => 'Repositories\\Eloquent', //> 模型 Eloquent 目录
  221. 'interfaces' => 'Repositories', //> 模型 Eloquent 接口目录
  222. 'transformers' => 'Transformers', //> 处理Model查询数据
  223. 'presenters' => 'Presenters', //> 处理Model查询出来的数据
  224. 'validators' => 'Validators', //> 验证器目录
  225. 'controllers' => 'Http/Controllers', //> 控制器目录
  226. 'provider' => 'RepositoryServiceProvider', //> 服务提供者注册目录
  227. 'criteria' => 'Criteria', //> 查询过滤文件目录
  228. 'stubsOverridePath' => app_path()
  229. ]
  230. ]
  231. ];