/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { if (isset($request->title) && isset($request->blog)) { $img = time() . "." . \Input::file('img')->getClientOriginalExtension(); \Input::file('img')->move('uploads', $img); $data = ['name' => $request->title, 'seo' => str_slug($request->title), 'content' => $request->blog, 'user_id' => \Auth::user()->id, 'img' => $img]; if (isset($request->sections_ids)) { $data['sections'] = $request->sections_ids; } App\Blog::insert($data); } return \Redirect::to('admin'); }