class ProductsRelationManager extends RelationManager
{
protected static string $relationship = 'products';
protected static ?string $inverseRelationship = 'orders';
public function form(Form $form): Form
{
return $form
->schema([]);
}
public function table(Table $table): Table
{
return $table
->recordTitleAttribute('order_id')
->columns([
Tables\Columns\TextColumn::make('name'),
])
->filters([
//
])
->headerActions([
Tables\Actions\AssociateAction::make()->form(fn (AssociateAction $action): array => [
$action->getRecordSelect(),
Forms\Components\Select::make('name')
->options(Product::all()->pluck('name', 'id'))
->required(),
]),
])
->actions([
Tables\Actions\DissociateAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DissociateBulkAction::make(),
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
}
class ProductsRelationManager extends RelationManager
{
protected static string $relationship = 'products';
protected static ?string $inverseRelationship = 'orders';
public function form(Form $form): Form
{
return $form
->schema([]);
}
public function table(Table $table): Table
{
return $table
->recordTitleAttribute('order_id')
->columns([
Tables\Columns\TextColumn::make('name'),
])
->filters([
//
])
->headerActions([
Tables\Actions\AssociateAction::make()->form(fn (AssociateAction $action): array => [
$action->getRecordSelect(),
Forms\Components\Select::make('name')
->options(Product::all()->pluck('name', 'id'))
->required(),
]),
])
->actions([
Tables\Actions\DissociateAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DissociateBulkAction::make(),
Tables\Actions\DeleteBulkAction::make(),
]),
]);
}
}