Unable to use InteractsWithActions and InteractsWithRecord at the same time

I'm trying to upgrade my app from v3 -> v4. The problem I am trying to solve: How can I make it so I can define actions in my blade template and use InteractsWithRecord? I'm getting this error, which tells me I probably need to add InteractsWithActions: Property [$actionDoSomething] not found on component: [app.filament.resources.stuffhere] If I try to add InteractsWithActions with my other traits, I get several conflicts:
Trait method 'getMountedActionSchemaModel' will not be applied because it collides with 'InteractsWithRecord'
Trait method 'afterActionCalled' will not be applied because it collides with 'InteractsWithRecord'
Trait method 'getDefaultActionSuccessRedirectUrl' will not be applied because it collides with 'InteractsWithRecord'
Trait method 'getDefaultActionRecordTitle' will not be applied because it collides with 'InteractsWithRecord'
Trait method 'getDefaultActionRecord' will not be applied because it collides with 'InteractsWithRecord'
Trait method 'getMountedActionSchemaModel' will not be applied because it collides with 'InteractsWithRecord'
Trait method 'afterActionCalled' will not be applied because it collides with 'InteractsWithRecord'
Trait method 'getDefaultActionSuccessRedirectUrl' will not be applied because it collides with 'InteractsWithRecord'
Trait method 'getDefaultActionRecordTitle' will not be applied because it collides with 'InteractsWithRecord'
Trait method 'getDefaultActionRecord' will not be applied because it collides with 'InteractsWithRecord'
I have a filament page defined like so:
use Filament\Actions\Contracts\HasActions;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Resources\Pages\Concerns\InteractsWithRecord;
use Filament\Resources\Pages\Page;


class MyPageWithActions extends Page implements HasForms, HasActions
{
use InteractsWithRecord, InteractsWithForms;
protected static string $resource = MyResource::class;
public string|int|null|Model $record;


public function actionDoSomething()
{
return Action::make('actionDoSomething')...
}
}
use Filament\Actions\Contracts\HasActions;
use Filament\Forms\Contracts\HasForms;
use Filament\Forms\Concerns\InteractsWithForms;
use Filament\Resources\Pages\Concerns\InteractsWithRecord;
use Filament\Resources\Pages\Page;


class MyPageWithActions extends Page implements HasForms, HasActions
{
use InteractsWithRecord, InteractsWithForms;
protected static string $resource = MyResource::class;
public string|int|null|Model $record;


public function actionDoSomething()
{
return Action::make('actionDoSomething')...
}
}
And in my blade file I have the following:
<x-filament-panels::page>
<x-filament::section>
<div>
{{ $this->actionDoSomething }}
</div>
<div class="mb-4">
{{ $this->myForm }}
</div>
</x-filament::section>
<x-filament-actions::modals/>
</x-filament-panels::page>
<x-filament-panels::page>
<x-filament::section>
<div>
{{ $this->actionDoSomething }}
</div>
<div class="mb-4">
{{ $this->myForm }}
</div>
</x-filament::section>
<x-filament-actions::modals/>
</x-filament-panels::page>
3 Replies
deadbeef
deadbeefOP2mo ago
I feel really goofy - it turns out that I was running into issues because I needed to specify the return type on the method for Filament to pick it up. Like public function actionDoSomething(): Action. No need to include InteractsWithActions if you already have InteractsWithRecords.
awcodes
awcodes2mo ago
Don’t feel goofy. Something’s aren’t always obvious. Even I didn’t catch it.

Did you find this page helpful?