Replies: 1 comment
-
From your description it seems to me you are after a The https://laravel.com/docs/8.x/eloquent-relationships#many-to-many-table-structure If I didn’t understood it well and you want to use a ->belongsToMany(Model::class, 'my_custom_table'); P.S.: sorry if the formatting is wrong, I am typing from my phone. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
mysql Ver 14.14 Distrib 5.7.32, for Linux (x86_64) using EditLine wrapper
Description:
I'm creating a custom model class for a relation.
when trying to get the related data, and sql error is issued and the select try to select a table that does not exists.
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'xxx.allergy_family_member_plan_setting_family_member_plan_setting' doesn't exist (SQL: select * from
allergy_family_member_plan_setting_family_member_plan_setting
wherefamily_member_plan_setting_id
= 1)Steps To Reproduce:
this will generate a model and a migration
change the migration:
add the relation to the FamilyMemberPlanSetting
then try this:
$fmps = FamilyMemberPlanSetting::create()
$fmps->allergies()->sync([]);
the an error like this is issued
notice the table name is: allergy_family_member_plan_setting_family_member_plan_setting and not 'allergy_family_member_plan_setting'
I have also tried to set the $table property in the model, but that does not make any difference
Beta Was this translation helpful? Give feedback.
All reactions