Support the ongoing development of Laravel.io →
Input Eloquent
Last updated 2 years ago.
0

add $res->save() ?

Last updated 2 years ago.
0

Now it looks like it's saving the data twice

Last updated 2 years ago.
0

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);
         $image->save($newName);
         $input['photo'] = $newName; 

        }
        $this->resident->create($input);

 }
Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

lstables lstables Joined 5 Jan 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.