In your PageBlock class, you control how data is structured and passed to the Blade view.
Defining the Schema
Use defineBlock(Block $block) to define the fields. You can use standard Filament fields and even conditionally show blocks based on the current layout:
public static function defineBlock(Block $block): Block
{
return $block->schema([
TextInput::make('name'),
]);
}
Mutating Data
By default, Blade props match the field names. Use mutateData(array $data) to transform the raw data before it reaches the view:
public static function mutateData(array $data): array
{
return ['foo' => 'bar'];
}
In your Blade component, you would then access this via @dump($foo).
public static function defineBlock(Block $block): Block
{
return $block->schema([
TextInput::make('name'),
]);
}
public static function mutateData(array $data): array
{
return ['foo' => 'bar'];
}