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) { $help = help::find($id); unlink($help->img); $help->delete(); return redirect('/'); }