Now it looks like it's saving the data twice
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);
}
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community