/** * Display event * * @param \Illuminate\Http\Request $request * @param int $id * * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View */ public function index(\Illuminate\Http\Request $request, $id) { $events = new Events(); $event = $events->getById($id); if ($event === null) { die; // @TODO: } /** * Facebook meta data */ $meta_data = (new \Flocc\Social\Facebook\MetaData())->setTitle($event->getTitle())->setDescription($event->getDescription())->setImage($event->getAvatarUrl()); /** * Update views */ $events->updateViews($event->getId(), $event->getViews() + 1); /** * Save user log */ (new User\Logs())->setUserId(Auth::getUserId())->setTypeEventsDisplay()->setEventId($event->getId())->save(); return view('events.event.index', ['event' => $event, 'meta_facebook' => $meta_data, 'message' => $request->session()->get('message'), 'comments_label' => $request->session()->get('comments_label', 'public'), 'user_id' => Auth::getUserId()]); }