Example #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $this->validate($request, Art::$create_rules);
     $input = array_except(Input::all(), array('_method', 'image'));
     $art = Art::create($input);
     $file = Input::file('image');
     $finalName = $art->id . '.' . $file->getClientOriginalExtension();
     $file->move(public_path("img/"), $finalName);
     $art->imageURL = $finalName;
     $art->save();
     return Redirect::route('art.index')->with('message', 'Obra agregada');
 }