This repository was archived by the owner on Jul 16, 2021. It is now read-only.

Description
Original Issue: laravel/framework#12238
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);