public function delete($id) { $event = Event::findOrFail($id); $event->delete(); flash('Ви успішно видалили подію!'); return back(); }
/** * Update the specified resource in storage. * * @param Request $request * @param int $id * @return Response */ public function update(EventRequest $request, $id) { $event = Event::findOrFail($id); $input = $request->input(); $validator = $event->getValidator($input); if ($validator->fails()) { return redirect()->back()->withInput()->withErrors(); } $event->event_name = $input['event_name']; $event->event_start_date = Carbon::createFromFormat('d/m/Y h:i A', $input['event_start_date']); $event->event_end_date = Carbon::createFromFormat('d/m/Y h:i A', $input['event_end_date']); $event->save(); return redirect()->route('event.show', [$event->slug])->with('message', 'Event Updated'); }
/** * @param $id * @return mixed */ public function getEvent($id) { return Event::findOrFail($id); }
public function getDetails(string $id_slug) { list($id, $name_slug) = unslug($id_slug); $event = Event::findOrFail($id); return view('event.details', compact('id', 'name_slug', 'event')); }
/** * Show a given event. * * @param Request $request * @param int $id * @return \Illuminate\View\View */ public function show(Request $request, $id) { $event = Event::findOrFail($id); return view('events.show', compact('event')); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $event = Event::findOrFail($id); $event->delete(); Flash::success('The event has been successfully deleted.'); return redirect('admin/events'); }
public function show($id) { $event = Event::findOrFail($id); $images = DB::table('files')->join('event_files', 'files.id', '=', 'event_files.file_id')->where('event_files.event_id', $event->id)->get(); return view('events.admin.detail', ['event' => $event, 'images' => $images]); }