Is it saving to the database? I have never used $user->save() in an if statement because that code shouldn't exacute just evaluate to true or false. I always pass the object in (this case $user) after it's created. If it isn't saved then it will evaluate to false. If a new object was created it should evaluate to true.
Oct 29, 2015
7
Level 5
Help: Eloquent save() stopped working
Hey. I wonder if anyone can help me - I'd be super grateful
My $user->save() has suddenly stopped working on my live server, but when testing it works locally and on dev/staging. Assuming it's a database issue, I've also tried cloning my live DB onto local, but I can't replicate.
My repository class does
if ( ! $user->save() ) {
throw new StorageException('Could not create user');
}
And on my live server i’ve started catching those exceptions every time the account / user edit page is submitted and the User model is saved.
Nothing else untoward in the logs, var_dump($user->save()) does indeed return false, and I've restarted nginx and mysql with no joy.
Any ideas?
Please or to participate in this conversation.