예제 #1
0
 public function delete($id)
 {
     $event = Event::findOrFail($id);
     $event->delete();
     flash('Ви успішно видалили подію!');
     return back();
 }
예제 #2
0
 /**
  * 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');
 }
예제 #3
0
 /**
  * @param $id
  * @return mixed
  */
 public function getEvent($id)
 {
     return Event::findOrFail($id);
 }
예제 #4
0
 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'));
 }
예제 #5
0
 /**
  * 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'));
 }
예제 #6
0
 /**
  * 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');
 }
예제 #7
0
 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]);
 }