After i set the column in migration like this :
$table->enum('paidBy',['BANK TRANSFERT', 'CARD'])->default('BANK TRANSFERT');
And added to my model :
protected $fillable = ['paidBy'];
protected $visible = ['paidBy'];
i wanted to update the column for a model but it's not working :
$ad->paidBy = 'CARD';
$ad->save();
How can i update it ?
CodePudding user response:
The problem is that i had a mutator for the column paidBy
that i forgot to delete. Now it's working
CodePudding user response:
A very common reason why it is not updated is that you forget to set the fillable in the model.
Put in the model you want to update: protected $fillable = ['paidBy'];
in the model.
update
Then try to update withd update function: $ad->update(['paidBy' => 'CARD']);