2017-06-09 02:28:26 +08:00
|
|
|
<?php
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Prettus Repository Config
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
return [
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Repository Pagination Limit Default
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
'pagination' => [
|
2018-08-27 00:40:04 +08:00
|
|
|
'limit' => 15,
|
2017-06-09 02:28:26 +08:00
|
|
|
],
|
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Fractal Presenter Config
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
Available serializers:
|
|
|
|
ArraySerializer
|
|
|
|
DataArraySerializer
|
|
|
|
JsonApiSerializer
|
|
|
|
|
|
|
|
*/
|
2018-08-27 00:40:04 +08:00
|
|
|
'fractal' => [
|
|
|
|
'params' => [
|
|
|
|
'include' => 'include',
|
2017-06-09 02:28:26 +08:00
|
|
|
],
|
2018-08-27 00:40:04 +08:00
|
|
|
'serializer' => League\Fractal\Serializer\DataArraySerializer::class,
|
2017-06-09 02:28:26 +08:00
|
|
|
],
|
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Cache Config
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
*/
|
2018-08-27 00:40:04 +08:00
|
|
|
'cache' => [
|
2017-06-09 02:28:26 +08:00
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Cache Status
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Enable or disable cache
|
|
|
|
|
|
|
|
|
*/
|
2018-08-27 00:40:04 +08:00
|
|
|
'enabled' => env('CACHE_ENABLED', false),
|
2017-06-09 02:28:26 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Cache Minutes
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Time of expiration cache
|
|
|
|
|
|
|
|
|
*/
|
2018-08-27 00:40:04 +08:00
|
|
|
'minutes' => 30,
|
2017-06-09 02:28:26 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Cache Repository
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Instance of Illuminate\Contracts\Cache\Repository
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
'repository' => 'cache',
|
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Cache Clean Listener
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
*/
|
2018-08-27 00:40:04 +08:00
|
|
|
'clean' => [
|
2017-06-09 02:28:26 +08:00
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Enable clear cache on repository changes
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
'enabled' => true,
|
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Actions in Repository
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| create : Clear Cache on create Entry in repository
|
|
|
|
| update : Clear Cache on update Entry in repository
|
|
|
|
| delete : Clear Cache on delete Entry in repository
|
|
|
|
|
|
|
|
|
*/
|
2018-08-27 00:40:04 +08:00
|
|
|
'on' => [
|
2017-06-09 02:28:26 +08:00
|
|
|
'create' => true,
|
|
|
|
'update' => true,
|
|
|
|
'delete' => true,
|
2018-08-27 00:40:04 +08:00
|
|
|
],
|
2017-06-09 02:28:26 +08:00
|
|
|
],
|
|
|
|
|
2018-08-27 00:40:04 +08:00
|
|
|
'params' => [
|
2017-06-09 02:28:26 +08:00
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Skip Cache Params
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| Ex: http://prettus.local/?search=lorem&skipCache=true
|
|
|
|
|
|
|
|
|
*/
|
2018-08-27 00:40:04 +08:00
|
|
|
'skipCache' => 'skipCache',
|
2017-06-09 02:28:26 +08:00
|
|
|
],
|
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Methods Allowed
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| methods cacheable : all, paginate, find, findByField, findWhere, getByCriteria
|
|
|
|
|
|
|
|
|
| Ex:
|
|
|
|
|
|
|
|
|
| 'only' =>['all','paginate'],
|
|
|
|
|
|
|
|
|
| or
|
|
|
|
|
|
|
|
|
| 'except' =>['find'],
|
|
|
|
*/
|
2018-08-27 00:40:04 +08:00
|
|
|
'allowed' => [
|
2017-06-09 02:28:26 +08:00
|
|
|
'only' => null,
|
2018-08-27 00:40:04 +08:00
|
|
|
'except' => null,
|
|
|
|
],
|
2017-06-09 02:28:26 +08:00
|
|
|
],
|
|
|
|
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Criteria Config
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Settings of request parameters names that will be used by Criteria
|
|
|
|
|
|
|
|
|
*/
|
2018-08-27 00:40:04 +08:00
|
|
|
'criteria' => [
|
2017-06-09 02:28:26 +08:00
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Accepted Conditions
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Conditions accepted in consultations where the Criteria
|
|
|
|
|
|
|
|
|
| Ex:
|
|
|
|
|
|
|
|
|
| 'acceptedConditions'=>['=','like']
|
|
|
|
|
|
|
|
|
| $query->where('foo','=','bar')
|
|
|
|
| $query->where('foo','like','bar')
|
|
|
|
|
|
|
|
|
*/
|
|
|
|
'acceptedConditions' => [
|
|
|
|
'=',
|
2018-08-27 00:40:04 +08:00
|
|
|
'like',
|
2017-06-09 02:28:26 +08:00
|
|
|
],
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Request Params
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
| Request parameters that will be used to filter the query in the repository
|
|
|
|
|
|
|
|
|
| Params :
|
|
|
|
|
|
|
|
|
| - search : Searched value
|
|
|
|
| Ex: http://prettus.local/?search=lorem
|
|
|
|
|
|
|
|
|
| - searchFields : Fields in which research should be carried out
|
|
|
|
| Ex:
|
|
|
|
| http://prettus.local/?search=lorem&searchFields=name;email
|
|
|
|
| http://prettus.local/?search=lorem&searchFields=name:like;email
|
|
|
|
| http://prettus.local/?search=lorem&searchFields=name:like
|
|
|
|
|
|
|
|
|
| - filter : Fields that must be returned to the response object
|
|
|
|
| Ex:
|
|
|
|
| http://prettus.local/?search=lorem&filter=id,name
|
|
|
|
|
|
|
|
|
| - orderBy : Order By
|
|
|
|
| Ex:
|
|
|
|
| http://prettus.local/?search=lorem&orderBy=id
|
|
|
|
|
|
|
|
|
| - sortedBy : Sort
|
|
|
|
| Ex:
|
|
|
|
| http://prettus.local/?search=lorem&orderBy=id&sortedBy=asc
|
|
|
|
| http://prettus.local/?search=lorem&orderBy=id&sortedBy=desc
|
|
|
|
|
|
|
|
|
*/
|
2018-08-27 00:40:04 +08:00
|
|
|
'params' => [
|
2017-06-09 02:28:26 +08:00
|
|
|
'search' => 'search',
|
|
|
|
'searchFields' => 'searchFields',
|
|
|
|
'filter' => 'filter',
|
|
|
|
'orderBy' => 'orderBy',
|
|
|
|
'sortedBy' => 'sortedBy',
|
2018-08-27 00:40:04 +08:00
|
|
|
'with' => 'with',
|
|
|
|
],
|
2017-06-09 02:28:26 +08:00
|
|
|
],
|
|
|
|
/*
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
| Generator Config
|
|
|
|
|--------------------------------------------------------------------------
|
|
|
|
|
|
|
|
|
*/
|
2018-08-27 00:40:04 +08:00
|
|
|
'generator' => [
|
2017-06-09 02:28:26 +08:00
|
|
|
'basePath' => app_path(),
|
|
|
|
'rootNamespace' => 'App\\',
|
|
|
|
'paths' => [
|
2018-08-27 00:40:04 +08:00
|
|
|
'models' => 'Models',
|
|
|
|
'repositories' => 'Repositories',
|
|
|
|
'interfaces' => 'Repositories',
|
|
|
|
'transformers' => 'Transformers',
|
|
|
|
'presenters' => 'Presenters',
|
|
|
|
'validators' => 'Validators',
|
|
|
|
'controllers' => 'Http/Controllers',
|
|
|
|
'provider' => 'RepositoryServiceProvider',
|
|
|
|
'criteria' => 'Criteria',
|
|
|
|
'stubsOverridePath' => app_path(),
|
|
|
|
],
|
|
|
|
],
|
2017-06-09 02:28:26 +08:00
|
|
|
];
|