To register a new component, you can utilize the registerComponent
method found in your Config
class. Here is an example demonstrating how to use this method:
...
public function boot()
{
parent::boot();
$this->registerComponent('component_name', ComponentClass::class);
}
...
All components must inherit from the Admin\Components\Component
class to ensure they are properly integrated and function as intended within the administrative framework.
To enhance your forms with additional components, you can make use of the registerFormComponent
method within your Config
class.
This involves specifying the name and the class of your input component.
Here is an example to illustrate this process:
...
public function boot()
{
parent::boot();
$this->registerFormComponent('form_component_name', FormComponentClass::class);
}
...
All form components must inherit from the Admin\Components\FormGroupComponent
class to ensure they are properly integrated and function as intended within the administrative framework.
To extend a table component and add a column modifier, you can follow these steps:
ModelTableExtension
class.boot
method of the Config
class.Here's an example of how you can do this:
use App\Admin\Extensions\ModelTableExtension;
...
public function boot()
{
parent::boot();
$this->registerModelTableExtensionClass(ModelTableExtension::class);
}
...
In this example, CustomModelTableExtension
is a custom class that extends ModelTableExtension
. You can implement any custom logic or methods in this class to extend the functionality of the table component. Then, in the boot
method of the Config
, you add your extension class to the list of extendable component classes using the registerModelTableExtensionClass
method. This makes your extension available for use in the table components throughout your application.
The ModelTableExtension
class provides several default extenders for the table component. Each of these extenders offers different functionalities to enhance the behavior and appearance of the table. Here's a brief overview of the default extenders:
These default extenders offer a wide range of functionalities to customize and enhance the behavior and appearance of the table component in your application. You can use them individually or in combination to meet your specific requirements.
There's no need to register an entire class when you aim to extend table columns; instead, you can utilize a method that allows the registration of a new method through a Closure:
...
public function boot()
{
parent::boot();
$this->registerModelTableExtension('model_table_extension_name', function () {
return 'model_table_extension'; // do something
});
}
...