calcaterra.luca23257
calcaterra.luca23257

Hi,

i'm writing a simple plugin (scaffolded with builder) for a crud thata manage cities (One Province for one city).

I created the relation of db (cities have a key provinceid) and a dropdown on form that retrieve list of provinces. Fetch Provinces works, but when click on create (save the record) i obtain the error "SQLSTATE[HY000]: General error: 1364 Field 'province_id' doesn't have a default value (SQL: insert into lc_gestimm_cities (name) values (Tolentino))" on line 664 of C:\laragon\www\october\vendor\laravel\framework\src\Illuminate\Database\Connection.php"

How i can manage the thing in a way that save the province id on city ?

Thanks,

Luca

Flynsarmy
Flynsarmy

Make sure the province_id field is set to NULLABLE in your database schema.

1-2 of 2