Kaesa Lyrih
Kaesa Lyrih
FFilament
Created by Kaesa Lyrih on 5/15/2025 in #❓┊help
Why Error inject param Action Class in `handleRecordUpdate()`
Error
Method 'App\Filament\Resources\UserResource\Pages\EditUser::handleRecordUpdate()' is not compatible with method 'Filament\Resources\Pages\EditRecord::handleRecordUpdate()'.
Method 'App\Filament\Resources\UserResource\Pages\EditUser::handleRecordUpdate()' is not compatible with method 'Filament\Resources\Pages\EditRecord::handleRecordUpdate()'.
<?php

declare(strict_types=1);

namespace App\Filament\Resources\UserResource\Pages;

use App\Actions\User\UpdateUserAction;

class EditUser extends EditRecord
{
protected static string $resource = UserResource::class;


protected function handleRecordUpdate(User $record, array $data, UpdateUserAction $action): User
{
return $action->handle($record, $data);;
}
}
<?php

declare(strict_types=1);

namespace App\Filament\Resources\UserResource\Pages;

use App\Actions\User\UpdateUserAction;

class EditUser extends EditRecord
{
protected static string $resource = UserResource::class;


protected function handleRecordUpdate(User $record, array $data, UpdateUserAction $action): User
{
return $action->handle($record, $data);;
}
}
Why?
3 replies
FFilament
Created by Kaesa Lyrih on 5/14/2025 in #❓┊help
What different `Filament::auth()->user()` & `auth()->user()`?
When shoulbe use Filment auth instance of auth()?
2 replies
FFilament
Created by Kaesa Lyrih on 5/12/2025 in #❓┊help
How to make logic `afterStateUpdateJs()` in filament v3?
No description
9 replies
FFilament
Created by Kaesa Lyrih on 5/10/2025 in #❓┊help
What different Action method `using` and `action` ?
I want overwrite logic CRUD Action. What method can i use to overwrite it using CreatePostAction, UpdatePostAction, DeletePostAction?
EditAction::make()
->using(function (Model $record, array $data): Model {
$record->update($data);

return $record;
})
EditAction::make()
->using(function (Model $record, array $data): Model {
$record->update($data);

return $record;
})
and
Action::make('sendEmail')
->form([
TextInput::make('subject')->required(),
RichEditor::make('body')->required(),
])
->action(function (array $data) {
Mail::to($this->client)
->send(new GenericEmail(
subject: $data['subject'],
body: $data['body'],
));
})
Action::make('sendEmail')
->form([
TextInput::make('subject')->required(),
RichEditor::make('body')->required(),
])
->action(function (array $data) {
Mail::to($this->client)
->send(new GenericEmail(
subject: $data['subject'],
body: $data['body'],
));
})
3 replies
FFilament
Created by Kaesa Lyrih on 5/8/2025 in #❓┊help
Where to Inject a Custom Action in Filament EditPage After Policy and Validation Are Passed?
Hi everyone! 👋 I'm currently building a custom UpdateUserAction and would like to integrate it properly into a Filament EditRecord page. --- My Goal: I want to run a custom action (e.g., UpdateUserAction) only after: 1. Policy Authorization has passed (can:update on the model) 2. Validation has been successfully performed using the form schema 3. Data has been potentially transformed (if needed) --- 🤔 My Main Question: Which method inside the EditRecord or EditUser page is best for injecting a custom action after authorization and validation have passed? I want to avoid doing policy or validation inside the action itself — my goal is to delegate those responsibilities to Filament’s internal authorization and validation flow, and only call the action after that. For example:
protected function handleRecordUpdate(Model $record, array $data, UpdateUserAction $action): Model
{
// This seems like the correct place?
return $action->handle($record, $data); // Return User Model
}
protected function handleRecordUpdate(Model $record, array $data, UpdateUserAction $action): Model
{
// This seems like the correct place?
return $action->handle($record, $data); // Return User Model
}
Is handleRecordUpdate() guaranteed to run only after policy and validation have passed? If not, is there a more appropriate method to override? --- 🛠️ Context: I want to avoid calling FormRequest manually inside this method — I'd rather lean on Filament’s built-in validation and authorization mechanisms that already wrap around the EditPage lifecycle. --- 🙏 What I'm Looking For: * Confirmation that handleRecordUpdate() is the right place to inject my custom action. * If not, what would be the best method/hook to override? * Any example of delegating business logic into an action after Filament’s validation/policy pipeline. Thanks in advance for your help! I’d love to make this pattern as clean and idiomatic as possible with Filament. 🔧
3 replies
FFilament
Created by Kaesa Lyrih on 5/7/2025 in #❓┊help
How to modify "Create Another" action in Filament to include a query parameter based on a form field
Question: I'm using FilamentPHP and I want to enhance the "Create Another" behavior when creating a resource (e.g., Product). Specifically, I'd like to redirect to the create page again, but with a query parameter (e.g., ?store_id=123) taken from the currently submitted form field (store_id). My goal is to make it easier for users who are adding multiple products to the same store consecutively. How can I modify the "Create Another" functionality in a custom CreateRecord page (like CreateProduct) to append this query parameter after saving? Any best practices or recommended approach? Use Case Example: * User selects a store (store_id = 5) while creating a product. * After saving and clicking "Create Another", the user is redirected to /admin/products/create?store_id=5, so the store_id field is pre-filled for the next product. Thanks in advance!
3 replies
FFilament
Created by Kaesa Lyrih on 8/31/2024 in #❓┊help
How to testing search select with dusk?
Can give me clue testing select and search option filament with dusk?
2 replies
FFilament
Created by Kaesa Lyrih on 5/19/2024 in #❓┊help
Can Query Model Pivot Custom Table without field id?
I'm trying to create a Custom Table with the Pivot Model Enrollment, but I encountered an error. I don't have the id field in the enrollments pivot table. How can I modify the query without using ORDER BY id? Should I add the id field to the pivot table? - Error: SQLSTATE[42703]: Undefined column: 7 ERROR: column enrollments.id does not exist LINE 1: select * from "enrollments" order by "enrollments"."id" asc ... ^
SELECT * FROM "enrollments" ORDER BY "enrollments"."id" ASC limit 10 OFFSET 0
SELECT * FROM "enrollments" ORDER BY "enrollments"."id" ASC limit 10 OFFSET 0
5 replies
FFilament
Created by Kaesa Lyrih on 5/7/2024 in #❓┊help
how to get data in action child from action parent?
I need data form Action parent_action in Action child child_action modalContent().
Actions\Action::make('parent_action')
->form([
Forms\Components\Select::make('wallet_id'),
Forms\Components\DatePicker::make('start_transaction_at'),
Forms\Components\DatePicker::make('end_transaction_at'),
])
->extraModalFooterActions(fn ($action, $arguments, $data): array => [
Actions\Action::make('child_action')
->modal()
->modalContent(
function ($record, $livewire) use ($action, $arguments, $data) {
dd([$data, $record, $livewire, $arguments, $action]);
$object = '...';
return str($object)->toHtmlString();
}
)
])
->modalSubmitAction(false),
Actions\Action::make('parent_action')
->form([
Forms\Components\Select::make('wallet_id'),
Forms\Components\DatePicker::make('start_transaction_at'),
Forms\Components\DatePicker::make('end_transaction_at'),
])
->extraModalFooterActions(fn ($action, $arguments, $data): array => [
Actions\Action::make('child_action')
->modal()
->modalContent(
function ($record, $livewire) use ($action, $arguments, $data) {
dd([$data, $record, $livewire, $arguments, $action]);
$object = '...';
return str($object)->toHtmlString();
}
)
])
->modalSubmitAction(false),
6 replies
FFilament
Created by Kaesa Lyrih on 3/29/2024 in #❓┊help
Where documentation From\Components\Group, and what different From\Components\Grid?
I need to group fields without labels, and color the background. Should I use Group or Grid? Will the Group be deprecated?
3 replies
FFilament
Created by Kaesa Lyrih on 12/11/2023 in #❓┊help
filter table column relation
How to make SelectFilter enum Columns current_school in table student via table student_product ? I want to filter this columns.
Tables\Columns\TextColumn::make('student.current_school'),
Tables\Columns\TextColumn::make('student.current_school'),
table student:
$table->enum('current_school', ['PAUD', 'TK', 'SD', 'SMP', 'SMK'])->nullable();
$table->enum('current_school', ['PAUD', 'TK', 'SD', 'SMP', 'SMK'])->nullable();
Model StudentProduct.php
public function student()
{
return $this->belongsTo(Student::class, 'student_id');
}
public function student()
{
return $this->belongsTo(Student::class, 'student_id');
}
4 replies
FFilament
Created by Kaesa Lyrih on 11/14/2023 in #❓┊help
Summarize Table RelationManager
I am attempting to use the summarize feature from Filament on a table that exists in RelationManager. However, I encounter an error:
SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'id'
SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'id'
When I remove $table->id() in create_package_product_table.php, the error changes to:
SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'created_at'
SQLSTATE[42S21]: Column already exists: 1060 Duplicate column name 'created_at'
If I remove $table->timestamps() in create_package_product_table.php, the summarize feature can be used. How can I use summarize on a table in RelationManager without having to remove $table->id() and $table->timestamps()?
5 replies