/** * store a new event * @param \Illuminate\Http\Request * @return void */ public function storeEvent(Request $request) { /** * create the new event * @param event_title => $request->get('event_title'), * @param event_game => $request->get('event_game'), * @param event_description => $request('event_description'), * @param event_date => Carbon\Carbon::now() * @param event_time => Carbon::time() * @param user_id => Auth::user->id * @return model */ Events::create(['event_title' => $request->get('event_title'), 'event_game' => $request->get('event_game'), 'event_description' => $request('event_description'), 'event_date' => Carbon::now(), 'event_time' => Carbon::time(), 'user_id' => Auth::user()->id]); /** * redirect the user to the events page * @param $view = /events */ return redirect('/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'); }