/** * Store a newly created resource in storage. * * @return Response */ public function store() { $infoPage = new InfoPage(); $infoPage->title = Input::get('title'); $infoPage->content = Input::get('content'); $infoPage->parent_id = is_numeric(Input::get('parent_id')) ? Input::get('parent_id') : NULL; // turn non-numeric & empty values into NULL if (!$infoPage->save()) { return Redirect::route('infoPage.create')->withErrors($infoPage->errors()); } return Redirect::route('infoPage.show', array('infoPage' => $infoPage->id)); }