RelationManager table working, but actions are not

I have a resource with a RelationManager at the bottom. This is all working fine, the table shows what I'd expect, etc... Unfortunately, clicking the edit action doesn't actually take you to the form for the related record. An XHR request is fired and is successful (No errors), but nothing happens on the page. I've been debugging and messing with this for a couple of hours and I'm just not sure what the problem could be at this point. I feel like I have exhausted everything that I can think of. I am not new to PHP nor Laravel at all. New-ish (One year of use) to Filament. This isn't the first time I've used a RelationManager, but it is the first time I haven't been able to make it work the way I want it to. I have upgraded filament, cleared caches, deleted the resources/views/vendor directory, done everything I can think of to make it work, and still when I click Edit, nothing happens. I'm not sure of what I'm missing. Code to follow shortly because of Discord's stupid character limit
6 Replies
specialk
specialkOP3mo ago
Here is my RelationManager:
<?php

namespace App\Filament\Master\Resources\TenantResource\RelationManagers;

use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables\Actions\EditAction;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;

class UsersRelationManager extends RelationManager
{
protected static string $relationship = 'users';

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

public function table(Table $table): Table
{
return $table
->recordTitleAttribute('name')
->columns([
TextColumn::make('name'),
TextColumn::make('email'),
]);
}
}
<?php

namespace App\Filament\Master\Resources\TenantResource\RelationManagers;

use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables\Actions\EditAction;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;

class UsersRelationManager extends RelationManager
{
protected static string $relationship = 'users';

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

public function table(Table $table): Table
{
return $table
->recordTitleAttribute('name')
->columns([
TextColumn::make('name'),
TextColumn::make('email'),
]);
}
}
My Tenant resource:
<?php

namespace App\Filament\Master\Resources;

use App\Filament\Master\Resources\TenantResource\Pages;
use App\Filament\Master\Resources\TenantResource\RelationManagers;
use App\Models\Tenant;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;

class TenantResource extends Resource
{
protected static ?string $model = Tenant::class;

protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';

public static function form(Form $form): Form
{
return $form
->schema([
//Inputs removed for space savings ]);
}

public static function table(Table $table): Table
{
return $table
->columns([//Removed for space]);
}

public static function getRelations(): array
{
return [
RelationManagers\UsersRelationManager::class
];
}

public static function getPages(): array
{
//removed for space
}
<?php

namespace App\Filament\Master\Resources;

use App\Filament\Master\Resources\TenantResource\Pages;
use App\Filament\Master\Resources\TenantResource\RelationManagers;
use App\Models\Tenant;
use Filament\Forms\Components\TextInput;
use Filament\Forms\Form;
use Filament\Resources\Resource;
use Filament\Tables;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;

class TenantResource extends Resource
{
protected static ?string $model = Tenant::class;

protected static ?string $navigationIcon = 'heroicon-o-rectangle-stack';

public static function form(Form $form): Form
{
return $form
->schema([
//Inputs removed for space savings ]);
}

public static function table(Table $table): Table
{
return $table
->columns([//Removed for space]);
}

public static function getRelations(): array
{
return [
RelationManagers\UsersRelationManager::class
];
}

public static function getPages(): array
{
//removed for space
}
My Tenant and CentralUser models:
public function users()
{
return $this->belongsToMany(CentralUser::class, 'tenant_users', 'tenant_id', 'global_user_id', 'id', 'global_id')
->using(TenantPivot::class);
}

public function tenants(): BelongsToMany
{
return $this->belongsToMany(Tenant::class, 'tenant_users', 'global_user_id', 'tenant_id', 'global_id', 'id')
->using(TenantPivot::class);
}
public function users()
{
return $this->belongsToMany(CentralUser::class, 'tenant_users', 'tenant_id', 'global_user_id', 'id', 'global_id')
->using(TenantPivot::class);
}

public function tenants(): BelongsToMany
{
return $this->belongsToMany(Tenant::class, 'tenant_users', 'global_user_id', 'tenant_id', 'global_id', 'id')
->using(TenantPivot::class);
}
JJSanders
JJSanders3mo ago
use Filament\Tables\Actions\EditAction;

public function table(Table $table): Table
{
return $table
->recordTitleAttribute('name')
->columns([
TextColumn::make('name'),
TextColumn::make('email'),
])
->actions([
EditAction::make(), // ← Important!
]);
}
use Filament\Tables\Actions\EditAction;

public function table(Table $table): Table
{
return $table
->recordTitleAttribute('name')
->columns([
TextColumn::make('name'),
TextColumn::make('email'),
])
->actions([
EditAction::make(), // ← Important!
]);
}
This might work
specialk
specialkOP3mo ago
Sorry yes I already have that. I accidentally removed that while posting here due to character limitations. I was trying to clean it up and got rid of it. I HAVE the action in the table. It is clickable. It's just that all that happens is that it fires off an XHR request (which returns a 200 OK response and some JSON), but doesn't actually DO anything.
JJSanders
JJSanders3mo ago
Do you see any errors in the console? Any Javascript errors or so?
specialk
specialkOP3mo ago
No. As stated in the first post - The XHR request is sent and receives a 200 OK response. No console errors. No error log errors.
Dennis Koch
Dennis Koch3mo ago
Do you have an EditPage? Or do you want to show it in a modal?

Did you find this page helpful?