phplaravellucid

Exception Message -> Array to string conversion" Laravel


I am using Laravel lucid framework and I have to call model setAttribute explicitly but getting below error:

ErrorException: Array to string conversion in

Code is

$user = new User;
$user->setAttribute('email',$this->email);
print_r($user);exit();

Please help

Thanks


Solution

  • Try to use implode() method ? :

    $test = implode('', $array);
    
    $user = new User;
    $user->setAttribute('email', $test);
    print_r($user);
    exit();