public function contactId($id) { $info = info::where('name', 'contact')->limit(1)->get()[0]; $helps = help::all(); $events = event::all(); $services = service::all(); $checkServiceArray = eventServices::where('event_id', $id)->get(); $checkService; $currEvent = event::find($id); foreach ($checkServiceArray as $check) { $checkService[] = $check->service_id; } if (!empty($currEvent)) { return view('pages.contact', compact('helps', 'events', 'services', 'checkService', 'currEvent', 'info')); } return redirect('/contact'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { foreach (servicePic::where('service_id', $id)->get() as $s) { unlink($s->pic); $s->delete(); } foreach (eventServices::where('service_id', $id)->get() as $s) { $s->delete(); } service::find($id)->delete(); return redirect('/'); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $event = event::find($id); foreach (eventServices::where('event_id', $id)->get() as $es) { $es->delete(); } $event->delete(); return redirect('/'); }