i am trying to upload an image as a profile picture in laravel bootstrap auth package. in this i am trying to change some package files to upload image. also i added a column in users table.
protected function create(array $data)
{
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
'campus_id' => $data['campus_id'],
'role' => $data['role'],
'remarks' => $data['remarks'],
'image' => $data['image'],
]);
}
i make changes in Auth controller in validation function also makes some changes in user store function
I think you need to move user profile image before create its entry inside database.
protected function create(array $data)
{
$imageName = time().'.'.$data['image']->extension();
//$data['image']->move(public_path('images'), $imageName);
$data['image']->storeAs('public/images', $imageName);
return User::create([
'name' => $data['name'],
'email' => $data['email'],
'password' => Hash::make($data['password']),
'campus_id' => $data['campus_id'],
'role' => $data['role'],
'remarks' => $data['remarks'],
'image' => $imageName,
]);
}