/** * get the events view * @return void */ public function events() { /** * get all the scheduled events from all the users * @param user_id(foreign key) => Auth::user()->id */ $events = Events::where('user_id', Auth::user()->id); /** * return events view with the all the events */ return view('pages.events')->with('events', $events); }
/** * thrash the chosen event * @param $id = INT * @return void */ public function thrashEvent($id) { Events::where('id', $id)->delete(); return redirect('/profile/{{Auth::user()->name}}/your-events'); }