php - Can't create object from array in Laravel 7
one text
Solution:
time fields needs to be specified in the $fillables array for it to be mass assignable (from an array while creating new model).
So in the model, the fillable array needs to be defined like so:
class Measure extends Model
{
protected $table = 'measures';
protected $casts = [
'time' => 'datetime'
];
public $timestamps = [
"time"
];
public $guarded = [
'id'
];
//**** fillables array *****//
protected $fillable = ['time'];
}
Source