/** * To insert a value to the table Page * @param type Request $request * @return type */ public function store(PageRequest $request) { $sl = $request->input('slug'); $slug = str_slug($sl, "-"); $this->page->slug = $slug; $this->page->fill($request->except('slug'))->save(); return redirect('page'); }
/** * To insert a value to the table Page * @param type Request $request * @return type */ public function store(PageRequest $request) { $sl = $request->input('slug'); $slug = str_slug($sl, "-"); $this->page->slug = $slug; try { $this->page->fill($request->except('slug'))->save(); return redirect('page')->with('success', 'Page created successfully'); } catch (Exception $e) { return redirect('page')->with('fails', $e->errorInfo[2]); } }