Relationmanager for other items from same user
I have a payment and user model. On the payment page i would like to show all the other payments from that same user, is this possible? And if so, what would be the simplest way to achieve this?
so basically a relationmanager for payment.user.payments
5 Replies
maybe it is possible to use
hasManyThrought()
?Can you add some more info? Is the payment page the payment form or the payment view?
On the PaymentResource i want to get a list below the view with all the other payments of this user
something like this:
but i'm not sure how i would get these other payments, since this doesn't work of course:
would i need to make a new method in my model? or is it possible with just filament code?
After creating a new method i've made it work using a hasMany relation 🙂
Update: HasManyThrough*
That works but a cleaner more “eloquent” way would have been to use a HasManyThrough relation: https://laravel.com/docs/10.x/eloquent-relationships#has-many-through
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
yeah, you're correct. Noticed something was wrong and when i changed it to a hasManyThrough everything worked perfectly!