final class ProductForm
{
/**
*
* @return array<int, mixed>
*/
public static function getFields(mixed $productId = null): array
{
return [
Select::make('product_id')
->hidden(function () use ($productId) {
return $productId !== null;
})
->relationship('product', 'name')
->required(),
TextInput::make('price')
->required()
->maxLength(55)
];
}
}
final class ProductForm
{
/**
*
* @return array<int, mixed>
*/
public static function getFields(mixed $productId = null): array
{
return [
Select::make('product_id')
->hidden(function () use ($productId) {
return $productId !== null;
})
->relationship('product', 'name')
->required(),
TextInput::make('price')
->required()
->maxLength(55)
];
}
}