Bhumi Shah
Bhumi Shah

Reputation: 9476

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

Upvotes: 0

Views: 248

Answers (1)

Ben
Ben

Reputation: 71

Try to use implode() method ? :

$test = implode('', $array);

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

Upvotes: 1

Related Questions