Support the ongoing development of →
Input Eloquent
Last updated 6 months ago.

add $res->save() ?

Last updated 6 months ago.

Now it looks like it's saving the data twice

Last updated 6 months ago.

I'm not sure exactly what you were trying to do because it looks like your creating an empty Residents eloqent instance and saving it then passing the raw input to the repository and creating a seperate instance, hence the duplicate entries.

Try something like this...

 public function store()
      $input = Input::all();
      if (Input::hasFile('photo')){

         $file = Input::file('photo');
         $name = $file->getClientOriginalName();
         $newName = public_path() . '/uploads/residents/' . $input['photo']->getClientOriginalName();

         $image = Image::make(Input::file('photo')->getRealPath())->resize(200, 200);
         $input['photo'] = $newName; 


Last updated 6 months ago.

Sign in to participate in this thread!


Your banner here too?

lstables lstables Joined 5 Jan 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2022 - All rights reserved.