minor update
parent
663a50ec03
commit
2b01d85371
|
|
@ -20,6 +20,7 @@ class CategoriesController extends Controller {
|
||||||
$registry = Registry::byUuid($request->get('registry'))->first();
|
$registry = Registry::byUuid($request->get('registry'))->first();
|
||||||
$parent = Category::byUuid($request->get('parent'))->first();
|
$parent = Category::byUuid($request->get('parent'))->first();
|
||||||
$query = $this->model->query()->where(['registry_id' => $registry->id ?? 0, 'parent_id' => $parent->id ?? 0]);
|
$query = $this->model->query()->where(['registry_id' => $registry->id ?? 0, 'parent_id' => $parent->id ?? 0]);
|
||||||
|
$query->orderBy('ord')->orderBy('id');
|
||||||
$paginator = $query->paginate(config('app.pagination_limit'));
|
$paginator = $query->paginate(config('app.pagination_limit'));
|
||||||
return fractal($paginator, new CategoryTransformer())->respond();
|
return fractal($paginator, new CategoryTransformer())->respond();
|
||||||
}
|
}
|
||||||
|
|
@ -30,6 +31,12 @@ class CategoriesController extends Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public function move(Request $request, $id) {
|
||||||
|
$model = $this->model->byUuid($id)->firstOrFail();
|
||||||
|
return $model;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public function store(Request $request): void {
|
public function store(Request $request): void {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,10 +20,7 @@ class EntriesController extends Controller {
|
||||||
|
|
||||||
public function index(Request $request): JsonResponse {
|
public function index(Request $request): JsonResponse {
|
||||||
$filters = collect($request->has('filters') ? json_decode($request->get('filters'), true) : [])->filter(function($val) {return $val;});
|
$filters = collect($request->has('filters') ? json_decode($request->get('filters'), true) : [])->filter(function($val) {return $val;});
|
||||||
//$registry = Registry::byUuid($request->get('registry'))->first();
|
|
||||||
//$category = Category::byUuid($request->get('category'))->first();
|
|
||||||
$query = $this->model->query();
|
$query = $this->model->query();
|
||||||
//if ($filters->except('registry')->isEmpty()) $query->where(['category_id' => $category->id ?? 0]);
|
|
||||||
$service = FiltersService::getService('registryEntries');
|
$service = FiltersService::getService('registryEntries');
|
||||||
$service->applyFilters($query, $filters);
|
$service->applyFilters($query, $filters);
|
||||||
$paginator = $query->paginate(config('app.pagination_limit'));
|
$paginator = $query->paginate(config('app.pagination_limit'));
|
||||||
|
|
@ -35,6 +32,11 @@ class EntriesController extends Controller {
|
||||||
return fractal($model, new EntryTransformer())->respond();
|
return fractal($model, new EntryTransformer())->respond();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function move(Request $request, $id) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public function store(Request $request): void {
|
public function store(Request $request): void {
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -92,6 +92,10 @@ class FieldsTableSeeder extends Seeder {
|
||||||
'type' => FieldType::STRING,
|
'type' => FieldType::STRING,
|
||||||
'required' => true
|
'required' => true
|
||||||
],
|
],
|
||||||
|
'target-blank' => [
|
||||||
|
'title' => 'Открывать в новом окне',
|
||||||
|
'type' => FieldType::BOOLEAN
|
||||||
|
],
|
||||||
|
|
||||||
'contact-name' => [
|
'contact-name' => [
|
||||||
'title' => 'Наименование',
|
'title' => 'Наименование',
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ class ObjectTypeFieldsTableSeeder extends Seeder {
|
||||||
],
|
],
|
||||||
'page-section-button' => [
|
'page-section-button' => [
|
||||||
'common' => [
|
'common' => [
|
||||||
'fields' => ['button-title', 'button-url']
|
'fields' => ['button-title', 'button-url', 'target-blank']
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'page-section-contacts' => [
|
'page-section-contacts' => [
|
||||||
|
|
|
||||||
|
|
@ -59,6 +59,8 @@ Route::group(['prefix' => 'registries'], function() {
|
||||||
Route::get('/', 'Api\Registries\RegistriesController@index');
|
Route::get('/', 'Api\Registries\RegistriesController@index');
|
||||||
Route::get('/{id}', 'Api\Registries\RegistriesController@show');
|
Route::get('/{id}', 'Api\Registries\RegistriesController@show');
|
||||||
Route::group(['middleware' => ['auth:api']], function() {
|
Route::group(['middleware' => ['auth:api']], function() {
|
||||||
|
Route::put('/categories/{id}', 'Api\Registries\CategoriesController@move');
|
||||||
|
Route::put('/entries/{id}', 'Api\Registries\EntriesController@move');
|
||||||
Route::delete('/categories/{id}', 'Api\Registries\CategoriesController@destroy');
|
Route::delete('/categories/{id}', 'Api\Registries\CategoriesController@destroy');
|
||||||
Route::delete('/entries/{id}', 'Api\Registries\EntriesController@destroy');
|
Route::delete('/entries/{id}', 'Api\Registries\EntriesController@destroy');
|
||||||
Route::delete('/operations/{id}', 'Api\Registries\OperationsController@destroy');
|
Route::delete('/operations/{id}', 'Api\Registries\OperationsController@destroy');
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue