Hi guys. I installed voyager by creating breads. There is a product relationship belongs to user that I defined in the breads only, not on the models in my code. But when I make $product->user it returns me null. But I know that if I defined the user() relationship on the Product model in my code it will return the user of this product.
My question is: do I necessarily have to create model relationships in my code before I can recover a relationship? So what is the point of creating relationships in bread then?
Add any other context or screenshots about the feature request here.
The relationships defined within Voyager are only available within Voyager. If you need to access that relation in code outside of Voyager, then you need to implement the method on your model class as well.
we acknowledge this is a limitation of Voyager, but it's one we haven't been able to overcome yet. At least, not without severely reducing our dependency requirements
@fletch3555 , thank you, i understand now about relationship.
-Another remark, the command "php artisan voyager:make:model" not working with me, it return something like class not define or not recognize if i remember well. but the command is available in compass menu. Can you tell me why..?
-But with voyager to switch from local to prod environnement i have to export the sql file for my local database i think.., right ?
-Using voyager, i don't now what wrong manipulation i do but i see all menu have duplication on admin panel in two lang.., what's wrong..?
best regards,
CLosing as the original question was answered.
Please ask all other questions in our Slack group.
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.
Most helpful comment
The relationships defined within Voyager are only available within Voyager. If you need to access that relation in code outside of Voyager, then you need to implement the method on your model class as well.
we acknowledge this is a limitation of Voyager, but it's one we haven't been able to overcome yet. At least, not without severely reducing our dependency requirements