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