master
parent
ea036c8913
commit
2ba4146f5b
|
|
@ -238,13 +238,12 @@ class MobileApiController extends Controller
|
|||
return false;
|
||||
}
|
||||
|
||||
dd($color);
|
||||
$started_at = Carbon::parse($started_at)->format('Y-m-d');
|
||||
$ended_at = Carbon::parse($ended_at)->format('Y-m-d');
|
||||
$cars = UniModel::model('pipi_auto')
|
||||
->where('is_inactive', '=', false)
|
||||
->where('model_id', $modelId)
|
||||
->where('color_id', $color->first()->id)
|
||||
->where('color_id', $color->id)
|
||||
->get();
|
||||
$busyCars = UniModel::model('pipi_auto_calendar')
|
||||
->whereBetween('date', [$started_at, $ended_at])
|
||||
|
|
@ -318,7 +317,7 @@ class MobileApiController extends Controller
|
|||
$carsByColor = $cars->groupBy('color_id');
|
||||
|
||||
foreach ($carsByColor as $carColor => $carsOfColor) {
|
||||
$carColor = UniModel::model('pipi_auto_colors')->find($carColor)->code;
|
||||
$carColor = UniModel::model('pipi_auto_colors')->find($carColor);
|
||||
|
||||
$colorPath = $path;
|
||||
if ($carsOfColor->first()->photo_id) {
|
||||
|
|
@ -326,11 +325,11 @@ class MobileApiController extends Controller
|
|||
$colorPath = url('api/files/file/' . ltrim($photo->path, '/'));
|
||||
}
|
||||
|
||||
if (!$this->checkAvailableCar($started_at, $ended_at, $mark->id, $carsOfColor)) {
|
||||
if (!$this->checkAvailableCar($started_at, $ended_at, $mark->id, $carColor)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$key = $mark->name . '-' . $mark->year . '-' . $carColor;
|
||||
$key = $mark->name . '-' . $mark->year . '-' . $carColor->code;
|
||||
|
||||
$availableMarks[$key] = [
|
||||
'id' => $mark->id,
|
||||
|
|
|
|||
Loading…
Reference in New Issue