I have a situation where I fetch a model in Laravel. Something like this:
$user = User::with('subscription')->where('id', '=', 123)->first();
If I then later try and do something like this:
$user->firstname = 'John';
$user->save();
I get an SQL error because it says that there is no DB field called "subscription" It seems like the relationship is being treated as a DB field when saving. Is that right? Am I mean to
unset($user->subscription)
before saving?
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2E3uspo
via IFTTT
Aucun commentaire:
Enregistrer un commentaire