Workflow
Datasource Relationship

This example demonstrates a Relationship with a Datasource.

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