From 2ba4146f5b7d2ded5254d8b4c92aad90413a2a1f Mon Sep 17 00:00:00 2001 From: Rustem Date: Sat, 24 May 2025 19:35:25 +0500 Subject: [PATCH] master --- app/Http/Controllers/MobileApiController.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/app/Http/Controllers/MobileApiController.php b/app/Http/Controllers/MobileApiController.php index 48e9ee1..3d61bd3 100644 --- a/app/Http/Controllers/MobileApiController.php +++ b/app/Http/Controllers/MobileApiController.php @@ -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,