Relation manager try to get relation with camel case

Empty relation manager, with only:
class DomainsRelationManager extends RelationManager
{
protected static string $relationship = 'domains';

public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('id')
->required()
->maxLength(255),
]);
}

public function table(Table $table): Table
{
return $table
->recordTitleAttribute('id')
->columns([
Tables\Columns\TextColumn::make('domain'),
])
->filters([
//
])
->headerActions([
Tables\Actions\AttachAction::make(),
])
->actions([
Tables\Actions\DetachAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DetachBulkAction::make(),
]),
]);
}
}
class DomainsRelationManager extends RelationManager
{
protected static string $relationship = 'domains';

public function form(Form $form): Form
{
return $form
->schema([
Forms\Components\TextInput::make('id')
->required()
->maxLength(255),
]);
}

public function table(Table $table): Table
{
return $table
->recordTitleAttribute('id')
->columns([
Tables\Columns\TextColumn::make('domain'),
])
->filters([
//
])
->headerActions([
Tables\Actions\AttachAction::make(),
])
->actions([
Tables\Actions\DetachAction::make(),
])
->bulkActions([
Tables\Actions\BulkActionGroup::make([
Tables\Actions\DetachBulkAction::make(),
]),
]);
}
}
When I try to attach, I get the error: Call to undefined method App\Models\Domain::gamesTypes() I have App\Models\Domain::games_types(), and it works on every relationship, but not in relation managers (tries several models) Is this a bug?
1 Reply
toeknee
toeknee2w ago
I don't think it's a bug just a standard, we use camelCase when auto looking for the relationship

Did you find this page helpful?