This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.

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

You cannot edit posts or make replies: the forum has moved to talk.octobercms.com.