I updated my project from v3.5 to v3.6 and now this code fails:
$record->image()->create([‘data’ => $this->path . $image]);
With this error:
SQLSTATE[HY000]: General error: 1364 Field ‘disk_name’ doesn’t have a default value (SQL: insert into system_files
(is_public
, field
, attachment_id
, attachment_type
, updated_at
, created_at
) values (1, image, 1, Utopigs\Banners\Models\BannerItem, 2024-03-08 16:46:38, 2024-03-08 16:46:38))
It works if I change the line to:
$record->image = (new \System\Models\File)->fromFile($this->path . $image);
$record->save();
But we are using this code in dozens of places where we import demo data for our plugins. Is this a bug that can be fixed in October, or will we have to change our code everywhere?