Open relation manager create modal from table action

I have two models A and B. A hasMany Bs so I have used relation manager for Bs. I want to create an action in A's list table to open the modal like the create action does in relation manager to create Bs right from A's list. Is this possible? Thank you for any insights.
2 Replies
Sujal Tamrakar
Sujal TamrakarOP13mo ago
Sorry I think I was not clear. I have a resource :
class A extends Resource
{
...
public function static table(...)
{
return $table
->columns([...])
->filters([...])
->actions([
[An action here similar to CreateAction in header actions of BRelationManager that does the same thing ]
])
...
}

public static function getRelations()
{
return [
BRelationManager::class
];
}
class A extends Resource
{
...
public function static table(...)
{
return $table
->columns([...])
->filters([...])
->actions([
[An action here similar to CreateAction in header actions of BRelationManager that does the same thing ]
])
...
}

public static function getRelations()
{
return [
BRelationManager::class
];
}
I have BRelationManager :
class BRelationManager extends RelationManager
{
...
public function static table(...)
{
return $table
->columns([...])
->filters([...])
->headerActions([
Tables\Actions\CreateAction::make()
->label('Add B')
->icon('heroicon-o-plus')
->modalHeading('Add B for ' . $this->ownerRecord->title)
->modalWidth('7xl'),
])
...
}
class BRelationManager extends RelationManager
{
...
public function static table(...)
{
return $table
->columns([...])
->filters([...])
->headerActions([
Tables\Actions\CreateAction::make()
->label('Add B')
->icon('heroicon-o-plus')
->modalHeading('Add B for ' . $this->ownerRecord->title)
->modalWidth('7xl'),
])
...
}
Want results from more Discord servers?
Add your server