Hemith
Hemith
FFilament
Created by Hemith on 11/28/2023 in #❓┊help
table column searchable() search on pressing enter
@props([
'wireModel' => 'tableSearch',
])

<div
x-id="['input']"
{{ $attributes->class(['fi-ta-search-field']) }}
>
<label x-bind:for="$id('input')" class="sr-only">
{{ __('filament-tables::table.fields.search.label') }}
</label>
<x-filament::input.wrapper
inline-prefix
prefix-icon="heroicon-m-magnifying-glass"
prefix-icon-alias="tables::search-field"
:wire:target="$wireModel"
>
<x-filament::input
autocomplete="off"
inline-prefix
:placeholder="__('filament-tables::table.fields.search.placeholder')"
type="search"
:wire:model="$wireModel"
wire:keydown.enter="getModelLabel"
x-bind:id="$id('input')"
:wire:key="$this->getId() . '.table.' . $wireModel . '.field.input'"
/>
</x-filament::input.wrapper>
</div>
@props([
'wireModel' => 'tableSearch',
])

<div
x-id="['input']"
{{ $attributes->class(['fi-ta-search-field']) }}
>
<label x-bind:for="$id('input')" class="sr-only">
{{ __('filament-tables::table.fields.search.label') }}
</label>
<x-filament::input.wrapper
inline-prefix
prefix-icon="heroicon-m-magnifying-glass"
prefix-icon-alias="tables::search-field"
:wire:target="$wireModel"
>
<x-filament::input
autocomplete="off"
inline-prefix
:placeholder="__('filament-tables::table.fields.search.placeholder')"
type="search"
:wire:model="$wireModel"
wire:keydown.enter="getModelLabel"
x-bind:id="$id('input')"
:wire:key="$this->getId() . '.table.' . $wireModel . '.field.input'"
/>
</x-filament::input.wrapper>
</div>
I did it like this. It's a bit hacky but it seems to work well.
5 replies
FFilament
Created by Hemith on 11/28/2023 in #❓┊help
table column searchable() search on pressing enter
@props([
'wireModel' => 'tableSearch',
])

<div
x-id="['input']"
{{ $attributes->class(['fi-ta-search-field']) }}
>
<label x-bind:for="$id('input')" class="sr-only">
{{ __('filament-tables::table.fields.search.label') }}
</label>

<x-filament::input.wrapper
inline-prefix
prefix-icon="heroicon-m-magnifying-glass"
prefix-icon-alias="tables::search-field"
:wire:target="$wireModel"
>
<x-filament::input
autocomplete="off"
inline-prefix
:placeholder="__('filament-tables::table.fields.search.placeholder')"
type="search"
:wire:model.live.debounce.500ms="$wireModel"
x-bind:id="$id('input')"
:wire:key="$this->getId() . '.table.' . $wireModel . '.field.input'"
/>
</x-filament::input.wrapper>
</div>
@props([
'wireModel' => 'tableSearch',
])

<div
x-id="['input']"
{{ $attributes->class(['fi-ta-search-field']) }}
>
<label x-bind:for="$id('input')" class="sr-only">
{{ __('filament-tables::table.fields.search.label') }}
</label>

<x-filament::input.wrapper
inline-prefix
prefix-icon="heroicon-m-magnifying-glass"
prefix-icon-alias="tables::search-field"
:wire:target="$wireModel"
>
<x-filament::input
autocomplete="off"
inline-prefix
:placeholder="__('filament-tables::table.fields.search.placeholder')"
type="search"
:wire:model.live.debounce.500ms="$wireModel"
x-bind:id="$id('input')"
:wire:key="$this->getId() . '.table.' . $wireModel . '.field.input'"
/>
</x-filament::input.wrapper>
</div>
I found this search-field.blade.php file and I copied it to my resources folder. I can't seem to figure out how to trigger the search only on button press.
5 replies
FFilament
Created by Hemith on 10/3/2023 in #❓┊help
Refetch RelationManager data on parent resource save
ohh maybe that's the case. I'm running filamentv3 with livewire3.
18 replies
FFilament
Created by Hemith on 10/3/2023 in #❓┊help
Refetch RelationManager data on parent resource save
hmm that's odd. You are on filament v3, correct? also, could you try running it inside the beforeSave() function?
18 replies
FFilament
Created by Hemith on 10/3/2023 in #❓┊help
Refetch RelationManager data on parent resource save
Hi @gon.exe . Yes, I added it at the EditPage in the beforeSave() function.
18 replies
FFilament
Created by Hemith on 10/25/2023 in #❓┊help
Opening a confirmation modal after validation.
I couldn't figure it out bro. I could only open the modal before validation
6 replies
FFilament
Created by Hemith on 11/12/2023 in #❓┊help
Get current page number for filament table.
Thanks!
5 replies
FFilament
Created by Hemith on 11/6/2023 in #❓┊help
Run a function after a table is loaded.
Yes. I was able to do with the livewire mount method. Thanks for the help!
6 replies
FFilament
Created by Hemith on 10/17/2023 in #❓┊help
Assert for custom form validation values
Got it. I could output the errors with
$component->errors();
$component->errors();
I can then check the validation error I want from there.
5 replies
FFilament
Created by Hemith on 10/17/2023 in #❓┊help
Assert for custom form validation values
If that is not possible, is it possible to output all errors for a component?
$component = livewire(CreateHorseShare::class)
->fillForm([
'user_id' => $user->id,
'horse_id' => $horse->id,
'quantity' => 11,
])
->call('create')
->assertHasFormErrors([
'quantity' => 'required'
]);
$component = livewire(CreateHorseShare::class)
->fillForm([
'user_id' => $user->id,
'horse_id' => $horse->id,
'quantity' => 11,
])
->call('create')
->assertHasFormErrors([
'quantity' => 'required'
]);
For this, how can i output all errors for $compnent?
5 replies
FFilament
Created by Hemith on 10/12/2023 in #❓┊help
Testing create form modal on ManageResource page.
I managed to do it like this
it('can create author', function () {
expect(Author::count())->toBe(0);

livewire(ManageAuthors::class)
->callAction(CreateAction::class, [
'name' => 'New Name',
'email' => '[email protected]'
])
->assertHasNoActionErrors();

$createdAuthor = Author::first();

expect($createdAuthor->name)->toBe('New Name');
expect($createdAuthor->email)->toBe('[email protected]');
expect(Author::count())->toBe(1);
});
it('can create author', function () {
expect(Author::count())->toBe(0);

livewire(ManageAuthors::class)
->callAction(CreateAction::class, [
'name' => 'New Name',
'email' => '[email protected]'
])
->assertHasNoActionErrors();

$createdAuthor = Author::first();

expect($createdAuthor->name)->toBe('New Name');
expect($createdAuthor->email)->toBe('[email protected]');
expect(Author::count())->toBe(1);
});
4 replies
FFilament
Created by Bloom on 10/7/2023 in #❓┊help
Using query builder on Hint or helperText
Select::make('product_id')
->live()
->required()
->relationship('product', 'name')
->searchable(),
TextInput::make('quantity')
->required()
->live()
->hint(function (Get $get) {
$productId = $get('product_id');
if ($productId) {
// Run query to get quantity and return
}

return null;
})
->integer()
Select::make('product_id')
->live()
->required()
->relationship('product', 'name')
->searchable(),
TextInput::make('quantity')
->required()
->live()
->hint(function (Get $get) {
$productId = $get('product_id');
if ($productId) {
// Run query to get quantity and return
}

return null;
})
->integer()
This is how I did it for my project. The hint function grabs the product_id whenever the select option change and run the query. Maybe this will help.
3 replies
FFilament
Created by Hemith on 10/3/2023 in #❓┊help
Refetch RelationManager data on parent resource save
Code on Parent Resource:
$this->dispatch('update-balance');
$this->dispatch('update-balance');
Code on RelationManager:
#[On('update-balance')]
public function updateBalance()
{
return;
}
#[On('update-balance')]
public function updateBalance()
{
return;
}
18 replies
FFilament
Created by Hemith on 10/3/2023 in #❓┊help
Refetch RelationManager data on parent resource save
I got it. I just dispatch an event to the relationmanager from parent resource. This reloads the relationmanager table.
18 replies
FFilament
Created by Hemith on 10/2/2023 in #❓┊help
Change fileupload area height for pdf
Ill try doing tht thanks
13 replies
FFilament
Created by Hemith on 10/2/2023 in #❓┊help
Change fileupload area height for pdf
I think it's because of the v3. When I was using filament v2, it was working fine.
13 replies
FFilament
Created by Hemith on 10/2/2023 in #❓┊help
Change fileupload area height for pdf
Do i need to set it with css?
13 replies
FFilament
Created by Hemith on 10/2/2023 in #❓┊help
Change fileupload area height for pdf
I added the imagePreviewHeight because the default was not working.
13 replies
FFilament
Created by Hemith on 10/2/2023 in #❓┊help
Change fileupload area height for pdf
still the same issue.
13 replies
FFilament
Created by Hemith on 10/2/2023 in #❓┊help
Change fileupload area height for pdf
Here is the code:
FileUpload::make('document_link')
->imagePreviewHeight('60')
->label('Document')
->disk('s3')
->directory('user-documents')
->visibility('public')
->openable()
->acceptedFileTypes(['application/pdf']),
FileUpload::make('document_link')
->imagePreviewHeight('60')
->label('Document')
->disk('s3')
->directory('user-documents')
->visibility('public')
->openable()
->acceptedFileTypes(['application/pdf']),
13 replies