Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Mubashar's avatar

I am doing this in AuthController and try to save image in Auth controller , it stores the data in DB but still image path is not stored in database. protected function create(array $data) { if($this->captchaCheck() == false) { flash('Wrong Captcha'); return redirect()->back() ->withErrors(['Wrong Captcha']) ->withInput(); } $user= User::create([ 'name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password']), 'nic'=>$data['nic'], 'contactNo'=>$data['contactNo'], 'CreditCardNo'=>$data['CreditCardNo'], 'country'=>$data['country'], 'role'=>$data['role'],

        ]);
    $imageName = $user->id . '_product.' .
        $user->file('image')->getClientOriginalExtension();
    $imageCompletePath = '/images/'. $imageName ;

    $data->file('image')->move(
        base_path() . '/public/images/', $imageName);

    $user->update(array('image' => $imageCompletePath));
    return $user;
Previous

Please or to participate in this conversation.