Introduction
You may create your own custom column classes and views, which you can reuse across your project, and even release as a plugin to the community. To create a custom column class and view, you may use the following command:resources/views/filament/tables/columns/audio-player-column.blade.php.
Filament table columns are not Livewire components. Defining public properties and methods on a table column class will not make them accessible in the Blade view.
Accessing the state of the column in the Blade view
Inside the Blade view, you may access the state of the column using the$getState() function:
Accessing the Eloquent record in the Blade view
Inside the Blade view, you may access the current table row’s Eloquent record using the$record variable:
Accessing the current Livewire component instance in the Blade view
Inside the Blade view, you may access the current Livewire component instance using$this:
Accessing the current column instance in the Blade view
Inside the Blade view, you may access the current column instance using$column. You can call public methods on this object to access other information that may not be available in variables:
Adding a configuration method to a custom column class
You may add a public method to the custom column class that accepts a configuration value, stores it in a protected property, and returns it again from another public method:$getSpeed() function:
Allowing utility injection in a custom column configuration method
Utility injection is a powerful feature of Filament that allows users to configure a component using functions that can access various utilities. You can allow utility injection by ensuring that the parameter type and property type of the configuration allows the user to pass aClosure. In the getter method, you should pass the configuration value to the $this->evaluate() method, which will inject utilities into the user’s function if they pass one, or return the value if it is static:
speed() method, and inject any utility as a parameter: