How can I change the assumed table name in a relation manager?

Hi everyone, I have a belongsToMany relation between a medications table and a presentation table. The pivot table includes extra information so I called it medication_variation. I created a relation manager but filament is looking for a table called medication_presentation. How can I change it ?
3 Replies
devfaysal
devfaysal16mo ago
How did you define the relationship in the Model? If the relationship works fine, then Filament should work fine. First check somewhere else that relationship working correctly. The easiest way to test is the web.php in the routes folder. define a test route and add code something like this:
$medication = Medication::first();
dd($medication->medication_variation);
$medication = Medication::first();
dd($medication->medication_variation);
guitarnerd_
guitarnerd_OP16mo ago
Thanks @devfaysal The problem was not having defined the inverse relationship
salma
salma16mo ago
you can also change the model name to "medication_presentation" and define the table name in the model as : protected $table=medication_variation;
Want results from more Discord servers?
Add your server