/** * Store a newly created resource in storage. * * @return Response */ public function store($society, $yr, GoalsRequest $request) { $goal = Goal::create($request->all()); $goal->completed = $request->input('completed', false); $goal->goalyear = $yr; $goal->society_id = $society; $goal->completed = 0; $goal->save(); return Redirect::route('society.goals.index', array($society, $yr))->with('okmessage', 'New goal has been added'); }
/** * Responds to POST::/user/goals/create. Creates a new goal with the values * in the request and redirects to the goals home page. * * @return Redirect to /user/goals */ public function postCreate(GoalRequest $request) { \App\Models\Goal::create(['user_id' => \Auth::id(), 'name' => $request->get('name'), 'body_measurement_type_id' => $request->get('body_measurement_type_id'), 'unit_id' => $request->get('unit_id'), 'value' => $request->get('value')]); \Session::flash('goal_create', 'Your goal was created!'); return redirect('/goals'); }