-
What happened?How to call relationship in $row rappasoft Here is my code:
$row->perizinans->id above not working to call relationship table, please help us to get another id table in relationship model in laravel Before i make column using relationship .perizinans.name, all working fine, and then when i call relation ship using row like $row->perizinans->id, not working Please help me, thanks How to reproduce the bugNo response Package Version2 PHP Version8.1.x Laravel Version10 Alpine Version3 ThemeBootstrap 4.x NotesNo response Error MessageNo response |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 8 replies
-
Use setAdditionalSelects() in your configure method. Or use the builder() to add a with() to reference the model. The package only loads the columns that are used or specified to optimize performance. |
Beta Was this translation helpful? Give feedback.
-
when i definition with in query, how to call that in $row ?? |
Beta Was this translation helpful? Give feedback.
-
Can you share your builder() code and I'll let you know. It'll be the same style however |
Beta Was this translation helpful? Give feedback.
Get rid of the $model reference as that is the alternative approach, and it is
public function builder(): Builder
not
public function query(): Builder
Then add the id for your relationship in setAdditionalSelects in your configure() method. You'll need to prefix it with the table name in your database.