How to use Eloquent's sushi, but the data is dynamic from API?
So, let's say I'm using a table filter, but its data is sourced from an API. Can we dynamically get the data? I reckon that using Sushi only allows you to source the data upfront. But I want to get the data dynamically based on table's filter
6 Replies
getRows()
should be called every time you change the filter/sort/etc. on the table.
Are you running into any issues?
OH, I think I misunderstood the question. You want to pass the active filters to Sushi, so they are included in the request to the API?yes!
do you have any idea on how to do that?
the current way is to... use request('filter.any_filter')
No! lol, don't use the request
1 sec, I can find an example for you. I'm not sure it's the best way, but it's how I'm doing it 🥴
call ->migrate() directly? 🥹
Here's a previous thread for reference. Not related to your issue directly but can be useful if you want to dig deeper:
https://discord.com/channels/883083792112300104/1120914138919612428/1121138618333929582
This is how I'm passing parameters to my Sushi models:
In this example, I'm passing a list of IDs to take into account in my
getRows()
method:
Oh nice!