You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
To create a table component you can start with the below stub:
26
26
27
-
```
27
+
```php
28
28
<?php
29
29
30
30
namespace App\Http\Livewire;
@@ -70,7 +70,7 @@ class UsersTable extends TableComponent
70
70
71
71
Your component must implement two methods:
72
72
73
-
```
73
+
```php
74
74
/**
75
75
* This defines the start of the query, usually Model::query() but can also eagar load relationships and counts.
76
76
*/
@@ -100,15 +100,15 @@ Obviously replace *users-table* with your component name.
100
100
101
101
You can define the columns of your table with the column class:
102
102
103
-
```
103
+
```php
104
104
Column::make('Name', 'column_name')
105
105
```
106
106
107
107
The first parameter is the name of the table header. The second parameter is the name of the table column. You can leave blank and the lowercase snake_case version will be used by default.
108
108
109
109
Here are a list of the column method you can chain to build your columns:
110
110
111
-
```
111
+
```php
112
112
/**
113
113
* This column is searchable, with no callback it will search the column by name or by the supplied relationship, using a callback overrides the default searching functionality.
114
114
*/
@@ -215,7 +215,7 @@ You can override any of these in your table component:
215
215
216
216
### Table Methods
217
217
218
-
```
218
+
```php
219
219
/**
220
220
* Used to set a class on a table header based on the column attribute
0 commit comments