/** * @param Inquiry $inquiry * @return \Illuminate\Http\RedirectResponse * @throws \Exception */ public function delete(Inquiry $inquiry) { $exists = OrganizationInquiry::where('inquiry_id', $inquiry->id)->pluck('organization_id'); if (count($exists) == 0) { $inquiry->delete(); return redirect()->route('admin::inquiry'); } else { echo 'in organizations: ' . implode(', ', array_unique($exists->all())); } }
/** * Редактирование примечания к запросу * @param Request $request * @param OrganizationInquiry $inquiry */ public function editInquiry(Request $request, OrganizationInquiry $inquiry) { $inquiry->note = $request->note; $inquiry->save(); }