Доработка апи
parent
3fddaba582
commit
682ef73690
|
|
@ -188,14 +188,13 @@ class MobileApiController extends Controller
|
|||
$ended_at = $request->query('ended_at');
|
||||
$class = $request->query('class');
|
||||
|
||||
$marks = UniModel::model('pipi_brand_models');
|
||||
if ($class) {
|
||||
$class_id = UniModel::model('pipi_auto_class')->firstWhere('name', $class)->id;
|
||||
$marks = $marks->where('class_id', $class_id);
|
||||
}
|
||||
$marks->get();
|
||||
$marks = UniModel::model('pipi_brand_models')->get();
|
||||
$availableMarks = [];
|
||||
|
||||
if ($class) {
|
||||
$class_id = UniModel::model('pipi_auto_classes')->where('name', $class)->first()->id;
|
||||
$marks = $marks->where('class_id', $class_id);
|
||||
}
|
||||
foreach ($marks as $mark) {
|
||||
if ($mark->name === 'Ввод остатков') {
|
||||
continue;
|
||||
|
|
@ -232,6 +231,7 @@ class MobileApiController extends Controller
|
|||
'engine_capacity' => $mark?->engine_capacity ?? 1591,
|
||||
'fuel_tank' => $mark?->fuel_tank ?? 50,
|
||||
'conditioner' => $mark?->conditioner,
|
||||
'photo' => lurl('/download/'.$mark?->photo_id),
|
||||
'tariffs' => $tariffs_new
|
||||
];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,6 +40,10 @@
|
|||
"conditioner": {
|
||||
"type": "bool"
|
||||
},
|
||||
"photo_id": {
|
||||
"type": "int",
|
||||
"validation": "nullable|int"
|
||||
},
|
||||
"brand_id": {
|
||||
"type": "foreign",
|
||||
"table": "pipi_auto_brands",
|
||||
|
|
@ -359,6 +363,14 @@
|
|||
"name": "conditioner",
|
||||
"label": "Кондиционер"
|
||||
}
|
||||
},
|
||||
{
|
||||
"size": 12,
|
||||
"input": {
|
||||
"name": "photo_id",
|
||||
"label": "Фото",
|
||||
"type": "file"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -448,6 +460,14 @@
|
|||
"name": "conditioner",
|
||||
"label": "Кондиционер"
|
||||
}
|
||||
},
|
||||
{
|
||||
"size": 12,
|
||||
"input": {
|
||||
"name": "photo_id",
|
||||
"label": "Фото",
|
||||
"type": "file"
|
||||
}
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
|
|||
|
|
@ -61,6 +61,12 @@ return new class extends \A7kz\Platform\Commands\InstallScript {
|
|||
$table->unsignedBigInteger('class_id')->nullable()->comment('Класс');
|
||||
});
|
||||
}
|
||||
|
||||
if (!Schema::connection($segment->connector)->hasColumn('pipi_brand_models', 'photo_id')) {
|
||||
Schema::connection($segment->connector)->table('pipi_brand_models', function ($table) {
|
||||
$table->unsignedBigInteger('photo_id')->nullable()->comment('Фото');
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in New Issue