ziolupo
Explore posts from serversTLCTuto's Laravel Corner
•Created by ziolupo on 1/26/2024 in #💡filament
Simple (modal) resource and mutateFormDataBeforeSave()
I have a problem with my simple resource.
I need to mutate the data before saving, but it's not possible to use mutateFormDataBeforeSave() as I would do with normal resource.
Any ideas?
I would like to add the following code:
I could use the boot() method on the model, but I would prefer not to do that.
Thank you
ZioLupo
5 replies
Error in extending tables
I would like to extend from Tables for creating my own class (in filament 3)
I created an empty class:
namespace App\Tables\Components;
use Filament\Tables\Table;
class MyTable extends Table{
}
but if I try to use MyTable in this way in a resource file:
public static function table(MyTable $table): MyTable
I have this error:
Declaration of App\Filament\Resources\ExhibitionResource::table(App\Tables\Components\MyTable $table): App\Tables\Components\MyTable must be compatible with Filament\Resources\Resource::table(Filament\Tables\Table $table):
And I cannot understand why.15 replies
Conditional widget based on RelationManager
I have a resource with two relationmanager:
public static function getRelations(): array
{
return [
RelationManagers\ProposalRelationManager::class,
RelationManagers\PartecipantsRelationManager::class,
];
}
The problem is that I want to show different widgets, based on different table when I switch tab from one relation to the other.
As showed above I have Proposal a Partecipant resource with different widgets
Inside the edit page I have:
protected function getHeaderWidgets(): array
{
return [
ProposalResource\Widgets\ProposalOverview::class,
];
}
but of course it's ok when the I hit the "proposal Tab", but when I'm clicking the Partecipant tab, I would like to load another widget.
Is this possible?
Thank you!3 replies