This forum has moved to a new location and is in read-only mode. Please visit talk.octobercms.com to access the new location.
Hi all
Again, other error on other form...
This form have a relation with other table and everything seem's working without problems util i try to save a record where i get the following error...
exception 'PDOException' with message 'SQLSTATE[42S22]: Column not found: 1054 Unknown column 'area_id_id' in 'field list'' in .../vendor/laravel/framework/src/Illuminate/Database/Connection.php:390
I don't have at any place the name "area_id_id" only the correct one "area_id". From where in the hell i get that field name... the values on the query are ok, just the field that relates with other table gets a additional "_id" at the end... strange... Someone have on the past similar problem ?
TIA
Last updated
Solved... i have the relation name wrong...
public $belongsTo = [
'area_id' => '\JML\Gkb\Models\Area'
];
where the correct one is...
public $belongsTo = [
'area' => '\JML\Gkb\Models\Area'
];
Lack of reading the documentation too fast :) JL
Hello jlongo,
I have exactly the same error as you : SQLSTATE[42S22]: Column not found: 1054 Unknown column 'districts_id' in 'field list'. I never called anywhere 'districts_id'...
I have a customer datas page that needs to store the datas of my customers, including his districts.
Maybe that comes from the fact that I created only the relation from the customerdatas (where the datas of my customers are stored) and I didn't write any relation in the RelationCustomerDistrict.php file...
Here is my relation name :
public $belongsTo=[
'districts' => [
'webapp\customerdatas\models\relationcustomerdistrict',
'table' => 'webapp_customerdatas_relation_customer_id_district',
'order' => 'district_name'
],
];
Thanks for helping me.
Louis
Last updated
Fast advice... read the documentatiom about field names in related tables. The main table must have field "id" and the child must have "
I hope that helps.
JL
1-4 of 4