Table column utility injection
The vast majority of methods used to configure columns accept functions as parameters instead of hardcoded values:Injecting the current state of a column
If you wish to access the current state (value) of the column, define a$state parameter:
Injecting the current Eloquent record
If you wish to access the current Eloquent record of the column, define a$record parameter:
null if the column is not bound to an Eloquent record. For instance, the label() method of a column will not have access to the record, as the label is not related to any table row.
Injecting the current column instance
If you wish to access the current column instance, define a$column parameter:
Injecting the current Livewire component instance
If you wish to access the current Livewire component instance that the table belongs to, define a$livewire parameter:
Injecting the current table instance
If you wish to access the current table configuration instance that the column belongs to, define a$table parameter:
Injecting the current table row loop
If you wish to access the current Laravel Blade loop object that the column is rendered part of, define a$rowLoop parameter:
$rowLoop is Laravel Blade’s $loop object, you can access the current row index using $rowLoop->index. Similar to $record, this parameter will be null if the column is currently being rendered outside a table row.