Get all the table columns from a resource
Would there be way to get all the columns from a resource?
Solution:Jump to solution
```php
protected function getResourceTableColumns(): array
{
$livewire = app('livewire')->new(ListRecords::class);
...
15 Replies
Need to get all the table columns from resource for a plugin im working on 🤔
->getTableColumns() probably
I wish👀
Actually this will work on the List page but im currently getting the Resource (in a plugin) then i want to get all the columns of that resource 🤔
Still looking for some help if someone knows how its done 🙂
resource::getTable()->getTableColumns() ?
GetTable expects $table with HasTable 🤔
There has to be a way to grab it, that’s what the list page is doing.
Check the ListRecord class
I tried to get it with list record but same thing it requires a livewire component, been going at it for a couple of hours now yikes 😅
Probably need some sleep and give it a fresh pair of eyes tomorrow
That sounds like a plan.
The plugin im working on requires me to get all available data from a table resource so if i cant get that then its game over💀
We’ll figure it out. Get some sleep.
I give up for today too. Can't seem to get past that it requires
Table $table
for everything I tried 🤌Same
Sounds like you want something like (untested):
Tried many of these variants can't seem to get it to work 😵💫
@dissto also tried a fair bit.
Solution