app/Http/Controllers/Auth/RegisterController.php
/**
     * Create a new user instance after a valid registration.
     *
     * @param array $data
     * @return \Illuminate\Database\Eloquent\Model
     */
Create a new user instance after a valid registration.
@param array $data
@return \Illuminate\Database\Eloquent\Model
Create a new user instance after a valid registration . @param array $data @return \ Illuminate \ Database \ Eloquent \ Model
protected function create(array $data): Model
    {
        $values = [
            'name' => $data['name'],
            'email' => $data['email'],
            'password' => Hash::make($data['password']),
        ];
        if (isset($data['profile_img'])) {
            $image = $data['profile_img'];
            $values['avatar_url'] = '/uploads/' . $image->store('user/avatars', [
                    'disk' => 'public',
                ]);
        } else {
            $values['avatar_url'] = '/images/default_avatar.png';
        }
        return User::query()->create($values);
    }
protected function create ( array $ data ) : Model { $ values = [ 'name' => $ data [ 'name' ] , 'email' => $ data [ 'email' ] , 'password' => Hash :: make ( $ data [ 'password' ] ) , ] ; if ( isset ( $ data [ 'profile_img' ] ) ) { $ image = $ data [ 'profile_img' ] ; $ values [ 'avatar_url' ] = '/uploads/' . $ image -> store ( 'user/avatars' , [ 'disk' => 'public' , ] ) ; } else { $ values [ 'avatar_url' ] = '/images/default_avatar.png' ; } return User :: query ( ) -> create ( $ values ) ; }
Create a new user instance after a valid registration.
Create a new user instance after a valid registration .
/** @var UploadedFile $image */