Normally when I call Model->save()
, it creates the new record in the database successfully. I'm trying to debug a situation when nothing happens and Model->save()
returns false. How do I find out what's happening?
$user = new User;
$user->fields = 'example';
$user->save(); // returns false
Running this does not show any insert queries.
dd(DB::getQueryLog());
But if I var_dump($user)
, I correctly get all the fields properly saved in the object.
Thanks!
If you just want to escape without knowing what is happening you can try this,
To get the insert queries when
$user->save();
error, you can try to catch the exception like this:Hope this helps :)