Load relationship on widget

I create a ManageRelatedRecord and add widget on it. While user save product card then it add the row on table below This is my widget
class AddProductCardWidget extends Widget implements HasForms
{
use InteractsWithForms;
use InteractsWithPageTable;

protected static string $view = 'filament.resources.product-resource.widgets.add-product-card-widget';

protected function getTablePage(): string
{
return ManageProductCards::class;
}

public function form(Form $form): Form
{
return $form->schema([
Select::make('rate_type_id')
->required()
->live()
->relationship('productCard', 'name'),
]);
}
}
class AddProductCardWidget extends Widget implements HasForms
{
use InteractsWithForms;
use InteractsWithPageTable;

protected static string $view = 'filament.resources.product-resource.widgets.add-product-card-widget';

protected function getTablePage(): string
{
return ManageProductCards::class;
}

public function form(Form $form): Form
{
return $form->schema([
Select::make('rate_type_id')
->required()
->live()
->relationship('productCard', 'name'),
]);
}
}
Inside MRR
protected function getHeaderWidgets(): array
{
return [
SpecialityResource\Widgets\AddProductCardWidget::class,
];
}
protected function getHeaderWidgets(): array
{
return [
SpecialityResource\Widgets\AddProductCardWidget::class,
];
}
1 Reply
Asmit Nepali
Asmit NepaliOP5mo ago
No description
Want results from more Discord servers?
Add your server