Mikazor
Mikazor
FFilament
Created by Mikazor on 9/27/2023 in #❓┊help
How to `->getOriginal()` from Model in `afterSave()` hook?
I need the original state of the model and I don't want to use observers
8 replies
FFilament
Created by Mikazor on 8/31/2023 in #❓┊help
How to test that field hidden in infolist?
Test:
it('not shows empty description', function () {
$project = Project::factory()->create(['description' => null]);

livewire(ViewProject::class, [
'record' => $project->getRouteKey(),
])
->assertFormFieldIsHidden('description');
});
it('not shows empty description', function () {
$project = Project::factory()->create(['description' => null]);

livewire(ViewProject::class, [
'record' => $project->getRouteKey(),
])
->assertFormFieldIsHidden('description');
});
Resource:
public static function infolist(Infolist $infolist): Infolist
{
return $infolist->schema([
Infolists\Components\Section::make()->schema([
Infolists\Components\TextEntry::make('name'),
Infolists\Components\TextEntry::make('description')
->label(false)
->hidden(fn($record) => !$record->description)
->markdown()
->columnSpanFull(),
])
]);
}
public static function infolist(Infolist $infolist): Infolist
{
return $infolist->schema([
Infolists\Components\Section::make()->schema([
Infolists\Components\TextEntry::make('name'),
Infolists\Components\TextEntry::make('description')
->label(false)
->hidden(fn($record) => !$record->description)
->markdown()
->columnSpanFull(),
])
]);
}
Error:
Failed asserting that a field with the name [description] is hidden on the form named [form] on the [App\Filament\Resources\ProjectResource\Pages\ViewProject] component.
Failed asserting that a field with the name [description] is hidden on the form named [form] on the [App\Filament\Resources\ProjectResource\Pages\ViewProject] component.
13 replies
FFilament
Created by Mikazor on 8/22/2023 in #❓┊help
Defer, debounce search in table
Is it possible to make a search in a table with a bigger debounce or defer (not live)?
3 replies
FFilament
Created by Mikazor on 8/21/2023 in #❓┊help
Add custom query to a filter
Tables\Filters\SelectFilter::make('causer_id')
->query(function (Builder $query, array $data): Builder {
return $query->where('id', 1);
})
Tables\Filters\SelectFilter::make('causer_id')
->query(function (Builder $query, array $data): Builder {
return $query->where('id', 1);
})
When I set a filter like in the example above my table always filtered and showed only one record with ID 1. I didn't apply the filter and the query string is empty. I want to add a custom query to a filter. How to achieve this?
8 replies
FFilament
Created by Mikazor on 8/17/2023 in #❓┊help
Customizing the creation process of relationship
I found in docs that I can customize the creation process of resources. How to get relationship data in the handleRecordCreate method? I want to use repository pattern
8 replies