Workflow
Datasource Relationship

This example demonstrates a Relationship with a Datasource.

ID
Name
Kitchen
1
Arkansas Possum Pie
SP
2
Albacore Tuna Melt
MG
3
Π±ΠΎΡ€Ρ‰
BA
4
Bacalhau com natas
SP
5
Baba Ghanoush
SP
6
Bacon Cheeseburger
RJ
7
Baked potato
BA
8
Baklava
MG
9
Bangers and mash
SP
10
Black Pudding
RJ
11
Blue cheese dressing
BA
12
Boulliabaise
RJ
13
Bread
BA
14
Breaded shrimp
SP
15
Breakfast burrito
SP
16
Brisket
SP
17
Brunswick stew
RJ
18
Bruschetta
SP
19
Buffalo Wings
RJ
20
Buffalo burger
MG
21
Buffalo wing
MG
22
Calamari
MG
23
Carne pizzaiola
SP
24
Caviar
SP
25
Ceviche
BA
26
Cheesecake
SP
27
Chicken Biryani
BA
28
Chicken Tikka Masala
RJ
29
Chicken and waffles
MG
30
Chicken bog
RJ
31
Chicken fingers
RJ
32
Chile Relleno
RJ
33
Chili con carne
MG
34
Chili dog
SP
35
Chimichanga
BA
36
Chinese food
MG
37
Chips and dip
SP
38
Choco pie
BA
39
Chocolate Brownie
SP
41
Chocolate cheesecake
BA
42
Chowder
MG
43
Churrasco
SP
44
Cinnamon Roll
RJ
45
Coleslaw
MG
46
Coq Au Vin
SP
47
Cordon bleu
BA
48
Currywurst
RJ
49
Eggo
SP
50
Eggs Benedict
BA
51
Eggs Neptune
RJ
52
Empanada
MG
53
Energy bar
RJ
54
Escargot
BA
55
Fajitas
SP
56
Falafel
BA
57
Fattoush Salad
RJ
58
Fish Tacos
MG
59
Fish and Chips!
MG
60
Flan
RJ
61
Fortune cookie
MG
62
Francesinha
MG
63
French Onion Soup
SP
64
Fries
MG
65
Frito Pie
SP
66
Fry sauce
RJ
67
Funnel Cake
RJ
68
Garden salad
BA
69
Garlic bread
MG
70
Gazpacho
SP
71
Goulash
RJ
72
Greek salad
RJ
73
Grilled Snake
BA
74
γύρος
BA
75
Gumbo
SP
76
Gyoza
MG
77
Huevos Rancheros
SP
78
Hummus
MG
79
Ice Cream
MG
80
Key Lime Pie
MG
81
Kimchi
RJ
82
Kobe Beef
RJ
83
Kung Pao Chicken
BA
84
Laksa
SP
85
Lasagna
RJ
86
Liver and onions
RJ
87
Lobster Newberg
BA
88
Lobster roll
SP
89
London broil
MG
90
Lorna Doone
BA
91
Low Country Boil
MG
92
Macaroni and Cheese
RJ
93
Macaroni and cheese
RJ
94
Macaroni salad
SP
95
Maine Lobster
MG
96
Mango and Sticky Rice
BA
97
Maple Bacon Doughnut
RJ
98
Maple bacon donut
MG
99
Maraca pie
MG
100
Margherita Pizza
SP
101
Mashed potato
SP
102
Mashed pumpkin
SP
103
Massaman Curry
SP
104
Matzo Ball Soup
MG
105
Meat Feast Pizza
RJ
106
Meatcake
BA
107
Meatloaf
SP
108
Milkshake
BA
109
Mini pizzas
SP
110
Mozzarella sticks
RJ
111
Muffuletta
MG
112
Mulligan stew
MG
113
Naan
SP
114
New York-Style Pizza
BA
115
Onion Rings
RJ
116
Oreo
SP
117
Osso Buco
SP
118
Paella
RJ
119
Pancakes
SP
120
Parma Ham
RJ
121
Pasta salad
BA
122
Pastel de Nata
SP
123
Pastrami
MG
124
Pastrami on Rye
BA
125
Patty
BA
126
Peixada da chef NΓ‘bia
BA
127
Peanut butter
MG
128
Pemmican
RJ
129
Pepperoni
RJ
130
Pepperoni Pizza
BA
131
Phaal
RJ
132
Philly Cheese Steak
RJ
133
Polenta
SP
134
Potato Wedges
MG
135
Potato salad
RJ
136
Potato skins
SP
137
Potato wedges
MG
138
Poutine
RJ
139
Quesadilla
BA
140
Ratatouille
MG
141
Ribs
MG
142
Risotto
BA
143
Roasted Bone Marrow
MG
144
Roasted Chickpeas
RJ
145
Samosa
RJ
146
Schnitzel
SP
147
Scrapple
BA
148
Sloppy joe
SP
149
Souvlaki
MG
150
Spaghetti Bolognese
SP
151
Spaghetti and Meatballs
MG
152
Spanish rice
SP
153
Spring Rolls
BA
154
Squab
RJ
155
St. Paul Sandwich
MG
156
Steak Tartare
MG
157
Steak sandwich
RJ
158
Steak sauce
RJ
159
Steamed clams
BA
160
Stroganoff
BA
161
Stuffed ham
MG
162
Stuffed peppers
SP
163
Stuffed zucchini
MG
164
Succotash
BA
165
Suckling Pig
BA
166
Supreme pizza
BA
167
Surf and turf
MG
168
Sushi
BA
169
Sueli's Sushi Boat
BA
170
Sweet Potato Fries
SP
171
Sweetbreads
BA
172
Swiss steak
SP
173
Tagine
RJ
174
Tamales
SP
175
Tetrazzini
BA
176
Texas Toast
BA
177
Thousand Island dressing
BA
178
Tin Roof Ice Cream
BA
179
Toaster Strudel
BA
180
Tomato compote
SP
181
Tres Leches Cake
SP
182
Tuna Pizza
BA
183
Tuna casserole
MG
184
Turducken
MG
185
Turkish Delight
RJ
186
VitΓ£o's Chocolate pie
RJ
187
Veggie Pizza
BA
188
Venison
RJ
189
Vichyssoise
BA
190
Waffle
SP
191
Wasabi Peas
MG
192
White chocolate cookie
BA
193
Yeung Chow fried rice
SP
Disclaimer: Table data is randomly generated for illustrative purposes only. The information here is not a reflection of the actual market and does not constitute business, financial, or medical advice.
πŸ”Ž View on GitHub
<?php
 
namespace App\Livewire\Examples\DatasourceRelationshipTable;
 
use App\Models\Dish;
use Illuminate\Database\Eloquent\Builder;
use PowerComponents\LivewirePowerGrid\Column;
use PowerComponents\LivewirePowerGrid\Facades\PowerGrid;
use PowerComponents\LivewirePowerGrid\PowerGridComponent;
use PowerComponents\LivewirePowerGrid\PowerGridFields;
 
final class DatasourceRelationshipTable extends PowerGridComponent
{
public function datasource(): ?Builder
{
return Dish::query()->with('kitchen');
}
 
public function fields(): PowerGridFields
{
return PowerGrid::fields()
->add('id')
->add('name')
->add('kitchen_description', fn ($dish) => e($dish->kitchen->description));
}
 
public function columns(): array
{
return [
Column::make('ID', 'id'),
 
Column::make('Name', 'name')
->sortable()
->searchable(),
 
Column::make('Kitchen', 'kitchen_description'),
];
}
}
Code highlighting provided by Torchlight.dev