/** * Store a newly created photo in storage. * * @return \Illuminate\View\View */ public function store() { $input = \Input::all(); $validation = new Validators\Photo(); if ($validation->passes()) { $filename = str_random(10) . time() . "." . \Input::file('photo_path')->getClientOriginalExtension(); $destination = "uploads/photos/"; $upload = \Input::file('photo_path')->move($destination, $filename); if ($upload == false) { return \Redirect::to('gallery.album.photo.create')->withInput()->withErrors($validation->errors)->with('message', \Lang::get('gallery::gallery.errors')); } $this->photo->create($input, $filename); return \Redirect::route("gallery.album.show", array('id' => $input['album_id'])); } else { return \Redirect::route('gallery.album.photo.create')->withInput()->withErrors($validation->errors)->with('message', \Lang::get('gallery::gallery.errors')); } }