Share components between Resources

Hi, I would like to config my Form and Table components in different Resources to avoid repeated code. Form and Table will have these standar components and their own components as usual. How could achive that? Thanks in advance
1 Reply
Patrick Boivin
One option is to create static methods or classes that can return a group of fields:
class HeaderFields
{
public static function make(): Group
{
return Group::make([
// Your fields here
]);
}
}
class HeaderFields
{
public static function make(): Group
{
return Group::make([
// Your fields here
]);
}
}
Then in your resources:
->schema([
HeaderFields::make(),

// ...
])
->schema([
HeaderFields::make(),

// ...
])
You can do something similar for table columns
Want results from more Discord servers?
Add your server