You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This might be related to #5578, but if I have a model that uses $casts, then the firstOrCreate() always creates a new instance. For example:
class MyModel extends \Illuminate\Database\Eloquent\Model {
$casts = [
'field' => 'array'
];
}
$data = [
'field' => [1,2,3]
];
// creates a new model$model = MyModel::firstOrCreate($data);
//...// also creates a new model instead of retrieving the first one$model2 = MyModel::firstOrCreate($data);