dimanche 30 juin 2019

Creating a default object from empty value while updating user profile record

I want to update user profile record, but while submitting, an error popped up with a message "Creating default object from empty value", when i remove if statements,and type only var_dump($data),,, it is running smoothly, and show all data, but in the presence of if commands, error popped up. i don't know, why it's happening, any help please,

class home extends Model {

protected $table="homes";
public static function upstore($data){
$firstname=Input::get('fname');
$lastname=Input::get('lname');
$phone=Input::get('phone');
$address=Input::get('address');
$profileimage=Input::get('pimage');
$password=Input::get('pswrd');
$confirmpassword=Input::get('cpswrd');

  if( $firstname != '' ){
    $homes->fname    = $firstname;
  }
 if( $lastname != '' ){
    $homes->lname    = $lastname;
  }
 if( $phone != '' ){
    $homes->phone    = $phone;
  }
 if( $address != '' ){
    $homes->address    = $address;
  }
 if( $profileimage != '' ){
    $homes->pimage    = $profileimage;
  }
 if( $password != '' ){
    $homes->pswrd    = $password;
  }
 if( $confirmpassword != '' ){
    $homes->cpswrd    = $confirmpassword;
  }

     $homes->save();
 }

}

It shows this error "Creating a default object from empty value"



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/301yx4t
via IFTTT

Aucun commentaire:

Enregistrer un commentaire