/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $album = new Album(); $album->fill($request->all()); $image = $request->file('thumbnail'); $fileName = ""; if ($image->isValid()) { $path = public_path() . '/uploads/albums/'; $fileName = str_random(32) . '.' . $image->getClientOriginalExtension(); $image->move($path, $fileName); } else { App::abort(404); } $album->thumbnail = $fileName; $album->save(); return Redirect::route('admin.album.show'); }