Доработка апи
parent
3fddaba582
commit
682ef73690
|
|
@ -188,14 +188,13 @@ class MobileApiController extends Controller
|
||||||
$ended_at = $request->query('ended_at');
|
$ended_at = $request->query('ended_at');
|
||||||
$class = $request->query('class');
|
$class = $request->query('class');
|
||||||
|
|
||||||
$marks = UniModel::model('pipi_brand_models');
|
$marks = UniModel::model('pipi_brand_models')->get();
|
||||||
if ($class) {
|
|
||||||
$class_id = UniModel::model('pipi_auto_class')->firstWhere('name', $class)->id;
|
|
||||||
$marks = $marks->where('class_id', $class_id);
|
|
||||||
}
|
|
||||||
$marks->get();
|
|
||||||
$availableMarks = [];
|
$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) {
|
foreach ($marks as $mark) {
|
||||||
if ($mark->name === 'Ввод остатков') {
|
if ($mark->name === 'Ввод остатков') {
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -232,6 +231,7 @@ class MobileApiController extends Controller
|
||||||
'engine_capacity' => $mark?->engine_capacity ?? 1591,
|
'engine_capacity' => $mark?->engine_capacity ?? 1591,
|
||||||
'fuel_tank' => $mark?->fuel_tank ?? 50,
|
'fuel_tank' => $mark?->fuel_tank ?? 50,
|
||||||
'conditioner' => $mark?->conditioner,
|
'conditioner' => $mark?->conditioner,
|
||||||
|
'photo' => lurl('/download/'.$mark?->photo_id),
|
||||||
'tariffs' => $tariffs_new
|
'tariffs' => $tariffs_new
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,6 +40,10 @@
|
||||||
"conditioner": {
|
"conditioner": {
|
||||||
"type": "bool"
|
"type": "bool"
|
||||||
},
|
},
|
||||||
|
"photo_id": {
|
||||||
|
"type": "int",
|
||||||
|
"validation": "nullable|int"
|
||||||
|
},
|
||||||
"brand_id": {
|
"brand_id": {
|
||||||
"type": "foreign",
|
"type": "foreign",
|
||||||
"table": "pipi_auto_brands",
|
"table": "pipi_auto_brands",
|
||||||
|
|
@ -359,6 +363,14 @@
|
||||||
"name": "conditioner",
|
"name": "conditioner",
|
||||||
"label": "Кондиционер"
|
"label": "Кондиционер"
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"size": 12,
|
||||||
|
"input": {
|
||||||
|
"name": "photo_id",
|
||||||
|
"label": "Фото",
|
||||||
|
"type": "file"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
@ -448,6 +460,14 @@
|
||||||
"name": "conditioner",
|
"name": "conditioner",
|
||||||
"label": "Кондиционер"
|
"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('Класс');
|
$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