class DoctorRelationManager extends RelationManager
{
protected static string $relationship = 'doctors';
public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('first_name')
->required()
->maxLength(255),
]);
}
public function table(Table $table): Table
{
return $table
->recordTitleAttribute('first_name')
->columns([
Tables\Columns\TextColumn::make('first_name'),
Tables\Columns\TextColumn::make('price'),
Tables\Columns\TextColumn::make('price_online'),
Tables\Columns\TextColumn::make('time'),
])
->filters([
//
])
->headerActions([
Tables\Actions\AttachAction::make()
->preloadRecordSelect()
->form(fn (Tables\Actions\AttachAction $action): array => [
$action->getRecordSelect(),
Forms\Components\TextInput::make('price')
->numeric()
->required()
->label("Price Offline (0 if not provided)")
->default(function () use ($action) {
return $action->parent?->default_price; // I want the default_price to be pulled from the parent Service class
}),
...
]),
])
->actions([
Tables\Actions\DetachAction::make(),
]);
}
}
class DoctorRelationManager extends RelationManager
{
protected static string $relationship = 'doctors';
public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('first_name')
->required()
->maxLength(255),
]);
}
public function table(Table $table): Table
{
return $table
->recordTitleAttribute('first_name')
->columns([
Tables\Columns\TextColumn::make('first_name'),
Tables\Columns\TextColumn::make('price'),
Tables\Columns\TextColumn::make('price_online'),
Tables\Columns\TextColumn::make('time'),
])
->filters([
//
])
->headerActions([
Tables\Actions\AttachAction::make()
->preloadRecordSelect()
->form(fn (Tables\Actions\AttachAction $action): array => [
$action->getRecordSelect(),
Forms\Components\TextInput::make('price')
->numeric()
->required()
->label("Price Offline (0 if not provided)")
->default(function () use ($action) {
return $action->parent?->default_price; // I want the default_price to be pulled from the parent Service class
}),
...
]),
])
->actions([
Tables\Actions\DetachAction::make(),
]);
}
}