How can I make a table in Orchid Laravel Package with data from array of objects? #2496
Unanswered
Linux-Alex
asked this question in
Q&A
Replies: 1 comment
-
Hi @Linux-Alex You need to wrap each element as a use Orchid\Screen\Repository;
public function query(): iterable
{
$productRawFromQuery = []; // Your array
$products = collect($productRawFromQuery)->map(fn(array $items) => new Repository($items));
return [
'products' => $products,
];
}
public function layout(): iterable
{
return [
Layout::table('products', [
TD::make('name'),
]),
];
} |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I'm making an WooCommerce administration center with the Laravel WooCommerce Package and Orchid - Laravel Admin Package.
I'm getting product data from Shops in an array format: Example
And I need to display this product in a table like this: Example
For this I need to make an WooCommerceProductListLayout that extends from the class Table. But this extended class can get data only from a database. I don't want all the data from variables saving to a database, because the data is very large and temporary.
I made the WooCommerceProductListLayout class, but I don't know how to avoid getting data from database. All the data should come from Product::all() or WooCommerce::all('products') and not the database.
They use static method from:
Please help me, thx
Beta Was this translation helpful? Give feedback.
All reactions