ProductsRelationManager.php
TLDR
This file contains the ProductsRelationManager
class, which is a relation manager for the "products" relationship in the Shop\BrandResource
. It includes methods for managing the form and table for this relationship.
Classes
ProductsRelationManager
The ProductsRelationManager
class is a relation manager that handles the "products" relationship in the Shop\BrandResource
. It extends the RelationManager
class.
Methods
form(Form $form): Form
This method is used to manage the form for the "products" relationship. It takes a Form
object as input and returns a Form
object.
table(Table $table): Table
This method is used to manage the table for the "products" relationship. It takes a Table
object as input and returns a Table
object. It sets the header actions, actions, and grouped bulk actions for the table.
<?php
namespace App\Filament\Resources\Shop\BrandResource\RelationManagers;
use App\Filament\Resources\Shop\ProductResource;
use Filament\Forms\Form;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables;
use Filament\Tables\Table;
class ProductsRelationManager extends RelationManager
{
protected static string $relationship = 'products';
protected static ?string $recordTitleAttribute = 'name';
public function form(Form $form): Form
{
return ProductResource::form($form);
}
public function table(Table $table): Table
{
return ProductResource::table($table)
->headerActions([
Tables\Actions\CreateAction::make(),
])
->actions([
Tables\Actions\DeleteAction::make(),
])
->groupedBulkActions([
Tables\Actions\DeleteBulkAction::make(),
]);
}
}