$this->row->ended_at) { $this->message = 'Вы не можете завершить заявку после даты окончания аренды'; return $this->response(); } $car = $this->row->car_id; if (isset($car)) { UniModel::model('pipi_auto_calendar') ->where('date', '>=', Carbon::now()->toDateString()) ->where('date', '<=', $this->row->ended_at) ->where('auto_id', $car)->delete(); } $this->row->status = ApplicationStatus::rejected->value; $this->row->ended_at = Carbon::now(); $this->row->save(); return $this->response(); } }