Hemith
Hemith
FFilament
Created by Hemith on 11/28/2023 in #❓┊help
table column searchable() search on pressing enter
Is there a way I can make it so that the search input only searches when I press enter instead of searching after I stopped typing?
5 replies
FFilament
Created by Hemith on 11/12/2023 in #❓┊help
Get current page number for filament table.
Is there a way I can retrive the current page number for a paginated table?
5 replies
FFilament
Created by Hemith on 11/6/2023 in #❓┊help
Run a function after a table is loaded.
I want to run a function after the ListResource page is loaded like an SQL query that markAsRead. Are there any lifecyclehooks I can use for table builder?
6 replies
FFilament
Created by Hemith on 10/25/2023 in #❓┊help
Opening a confirmation modal after validation.
Is there a way to open the confirmation modal after validation? I just want to add a modal as a final confirmation for the user data.
6 replies
FFilament
Created by Hemith on 10/17/2023 in #❓┊help
Assert for custom form validation values
An example would be from the filament docs:
TextInput::make('slug')->rules([
function () {
return function (string $attribute, $value, Closure $fail) {
if ($value === 'foo') {
$fail('The :attribute is invalid.');
}
};
},
])
TextInput::make('slug')->rules([
function () {
return function (string $attribute, $value, Closure $fail) {
if ($value === 'foo') {
$fail('The :attribute is invalid.');
}
};
},
])
How can I assert for this particular validation when testing forms? I'm not sure what name to use.
5 replies
FFilament
Created by Hemith on 10/12/2023 in #❓┊help
Testing create form modal on ManageResource page.
it('can create author', function () {
livewire(ManageAuthors::class)
->callAction(CreateAction::class)
->fillForm([
'name' => 'New Author',
'email' => '[email protected]'
])
->call('create');

dd(Author::all());
});
it('can create author', function () {
livewire(ManageAuthors::class)
->callAction(CreateAction::class)
->fillForm([
'name' => 'New Author',
'email' => '[email protected]'
])
->call('create');

dd(Author::all());
});
Here is my code for testing the form. But nothing seems to be outputting.
4 replies
FFilament
Created by Hemith on 10/12/2023 in #❓┊help
Difference between $data and $this->data in CreateResource
I want to know how the data is passed for the $data for functions in CreateResource.php. I want to pass some data from beforeCreate() to handleRecordCreation(). If I use the $data parameter, it doesn't get passed. But if I use $this->data, I can pass it from beforeCreate() to handleRecordCreation(). Is there a better way to do this ?
2 replies
FFilament
Created by Hemith on 10/7/2023 in #❓┊help
Access the current group data in summarizer.
public function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('quantity')
->summarize(Sum::make()),
])
->defaultGroup('product.name');
}
public function table(Table $table): Table
{
return $table
->columns([
TextColumn::make('quantity')
->summarize(Sum::make()),
])
->defaultGroup('product.name');
}
In this example, I'm showing the product orders table grouped by the product name showing total quantity for each. Can I get the product data in the summarizer for each group? I want to display the data like so: ( Sum of Quantity / product.total_quantity). Is this possible?
2 replies
FFilament
Created by Hemith on 10/3/2023 in #❓┊help
Refetch RelationManager data on parent resource save
Is there a way to refetch the query data for a relationmanager when the parent resource data is saved? Currently I just reload the page after I finished saving. I was wondering if there are any alternatives.
18 replies
FFilament
Created by Hemith on 10/2/2023 in #❓┊help
Change fileupload area height for pdf
No description
13 replies
FFilament
Created by Hemith on 9/24/2023 in #❓┊help
Table Column Action testing not working in Manage Page.
I'm getting the following error when I try to call a table column action in my ManageNewsPage.
Failed asserting that a table column with name [set_public] exists on the [App\Filament\Resources\NewsResource\Pages\ManageNews] component.
Failed asserting that null is an instance of class Filament\Tables\Columns\Column.
Failed asserting that a table column with name [set_public] exists on the [App\Filament\Resources\NewsResource\Pages\ManageNews] component.
Failed asserting that null is an instance of class Filament\Tables\Columns\Column.
Here is the test case:
it('can set news to public with button', function () {
$news = News::factory()->create([
'status' => '下書き'
]);
expect($news->status)->toBe('下書き');

livewire(NewsResource\Pages\ManageNews::class)
->callTableColumnAction('set_public', $news)
->assertTableColumnStateSet('status', '公開中');

$news->refresh();
expect($news->status)->toBe('公開中');
});
it('can set news to public with button', function () {
$news = News::factory()->create([
'status' => '下書き'
]);
expect($news->status)->toBe('下書き');

livewire(NewsResource\Pages\ManageNews::class)
->callTableColumnAction('set_public', $news)
->assertTableColumnStateSet('status', '公開中');

$news->refresh();
expect($news->status)->toBe('公開中');
});
Here are the table actions:
->actions([
Tables\Actions\EditAction::make()
->icon(null)
->label('編集')
->view('filament.actions.edit-modal-button'),
// Tables\Actions\DeleteAction::make(),
Tables\Actions\Action::make('set_public')
->label('公開')
->button()
->action(function ($record) {
$record->status = '公開中';
$record->save();
})
->view('filament.actions.public-only-status-button'),
]);
->actions([
Tables\Actions\EditAction::make()
->icon(null)
->label('編集')
->view('filament.actions.edit-modal-button'),
// Tables\Actions\DeleteAction::make(),
Tables\Actions\Action::make('set_public')
->label('公開')
->button()
->action(function ($record) {
$record->status = '公開中';
$record->save();
})
->view('filament.actions.public-only-status-button'),
]);
2 replies
FFilament
Created by Hemith on 6/30/2023 in #❓┊help
How to remove form action from resource modal?
I want to remove the default form actions Save Changes and Cancel from the Resource Modal when using ManageRecords. getFormActions() doesn't seem to be working. Any help is appreciated.
2 replies
FFilament
Created by Hemith on 6/29/2023 in #❓┊help
Separate auth session with filament and breeze
I want to make it so that user logged in with breeze has its own session and filament has its own session. I'm guessing I would need to use separate cookies? Is it possible to do this? Any help is appreciated.
2 replies
FFilament
Created by Hemith on 6/3/2023 in #❓┊help
Pass current record attributes to custom view.
I want to pass some record data to a custom view of my action. Something like this:
Tables\Actions\Action::make()
->view('test', ['record' => 'here'])
Tables\Actions\Action::make()
->view('test', ['record' => 'here'])
Is is possible? any help is appreciated.
4 replies
FFilament
Created by Hemith on 5/30/2023 in #❓┊help
One to many relation as collapsible in list view
1 replies
FFilament
Created by Hemith on 3/10/2023 in #❓┊help
Accessing the current model inside custom validation rule
Hi. Is there a way to access the current model value inside the custom validation function?
Forms\Components\Radio::make('status')
->options([
'draft' => 'Draft',
'public' => 'Public'
])
->descriptions([
'draft' => 'Will not be visible to students',
'public' => 'Will be visible to students'
])
->hiddenOn('create')
->default('draft')
->rules([
function () {
return function (string $attribute, $value, Closure $fail) {
// Here
};
}
])
->required(),
Forms\Components\Radio::make('status')
->options([
'draft' => 'Draft',
'public' => 'Public'
])
->descriptions([
'draft' => 'Will not be visible to students',
'public' => 'Will be visible to students'
])
->hiddenOn('create')
->default('draft')
->rules([
function () {
return function (string $attribute, $value, Closure $fail) {
// Here
};
}
])
->required(),
I want to check if the model has children or not.
2 replies