Tables permit the following props:
headings
items
headings: A collection of text names for the headings.
e.g. [ 'name', 'email', 'updated_at' ];
These should be exactly the same values as the model's property names.
Underscores and capitalization are handled automatically.
items: The collection of items displayed
The table below is using the following values:
$headings = collect(['name', 'email', 'updated_at'])
$items = collect([
App\Models\User {
id: 1,
name: 'Test User',
email: '[email protected]',
userid: 'testuser',
active: true,
created_at: '2024-06-24 14:33:58',
updated_at: '2024-08-30 19:57:50',
},
App\Models\User {
id: 2,
name: 'Happy User',
email: '[email protected]',
userid: 'happy',
active: true,
created_at: '2024-06-24 14:33:58',
updated_at: '2024-08-30 19:57:50',
},
])
The component was then used this way:
<x-bl.table :headings=$headings :items=$items />
| name | updated at | ||
|---|---|---|---|
| Test User | [email protected] | 2024-08-30 19:57:50 | Edit |
| Happy User | [email protected] | 2024-08-30 19:57:50 | Edit |
| Grumpy User | [email protected] | 2024-08-30 19:57:50 | Edit |