KeyMe
KeyMe
FFilament
Created by KeyMe on 10/23/2024 in #❓┊help
Table filter dropdown closes when custom filter (flatpickr) is active
No description
2 replies
FFilament
Created by KeyMe on 3/18/2024 in #❓┊help
Error on opening action modal in actionGroup after Livewire update
Upon updating livewire to v3.4.9, I'm facing this error of not being able to open action/header action that is in an action group. Anyone? Typed property Filament\Actions\MountableAction::$livewire must not be accessed before initialization
7 replies
FFilament
Created by KeyMe on 3/6/2024 in #❓┊help
Table widget tab filter in Dashboard
Question, out of the box, is it possible to implement table tab filter like List page class's inside the Dashboard table widget?
2 replies
FFilament
Created by KeyMe on 2/27/2024 in #❓┊help
Access repeater item value from outside
I tried to use $get('repeaterName') to access a repeater and gets below array:
array:1 [▼ // app/Filament/Resources/OrderResource.php:374
"d014ab83-5d0f-4ecf-a585-4f9582ffe4d9" => array:2 [▼
"addon_id" => "15"
"quantity" => null
]
]
array:1 [▼ // app/Filament/Resources/OrderResource.php:374
"d014ab83-5d0f-4ecf-a585-4f9582ffe4d9" => array:2 [▼
"addon_id" => "15"
"quantity" => null
]
]
Is there a way to change the array key name to something simpler?
2 replies
FFilament
Created by KeyMe on 2/26/2024 in #❓┊help
Wizard redirect to another wizard
Question, using wizard inside a panel resource for creation, is it possible to redirect to another wizard (to create relation records) after completing the last wizard?
2 replies
FFilament
Created by KeyMe on 1/24/2024 in #❓┊help
Livewire infolist component disappear on action/tab click
No description
4 replies
FFilament
Created by KeyMe on 1/15/2024 in #❓┊help
Replace mounted action passing arguments
After executing one of my custom page action, I replace it with another action passing along arguments, but when I tried to die n dumped it in the send email action class it returned null. Could someone tell me what I'm doing wrong? The $data array wasn't null in after() method. ViewOrder.php
protected function getActions(): array
{
return [
PostService::make()
->after(function (array $data) {
if ($this->record->training->status()->is('Training Arranged')) {
$this->replaceMountedAction('sendEmail', $data);
}
}),
];
}

public function sendEmail() { return SendEmail::make();}
protected function getActions(): array
{
return [
PostService::make()
->after(function (array $data) {
if ($this->record->training->status()->is('Training Arranged')) {
$this->replaceMountedAction('sendEmail', $data);
}
}),
];
}

public function sendEmail() { return SendEmail::make();}
SendEmail.php
class SendEmail extends Action
{
public static function getDefaultName(): ?string
{
return 'sendEmail';
}

protected function setUp(): void
{
parent::setUp();
dd($this->arguments);
}
class SendEmail extends Action
{
public static function getDefaultName(): ?string
{
return 'sendEmail';
}

protected function setUp(): void
{
parent::setUp();
dd($this->arguments);
}
2 replies
FFilament
Created by KeyMe on 1/9/2024 in #❓┊help
Confirmation message on custom action modal
No description
16 replies
FFilament
Created by KeyMe on 12/21/2023 in #❓┊help
Prevent action modal from closing automatically
Hi, quick question, is it possible to disable the behavior of action modal closing automatically when submit action button is clicked so that the modal stays open?
5 replies
FFilament
Created by KeyMe on 12/18/2023 in #❓┊help
DateTimePicker timezone issue
In an action, I have checkboxes where upon checking/un-checking, the corresponding datetimepicker field is set to now()->format('Y-m-d H:i:s') otherwise null. Casted the db fields to 'datetime'. Applied the timezone() method to use current user's timezone. Weird thing is, fields that are saved before and after applying timezone() are stored in database differently, the prior, stored in UTC & displayed as user timezone, the latter, stored in user's tz & displayed as UTC. On top of that, for fields stored as UTC in db, when i uncheck/re-check to fill new timestamp, it displays as UTC, is that normal? Below is the form:
Checkbox::make($checkbox)
->reactive()
->dehydrated(false)
->afterStateUpdated(fn ($get, $set) => $get($checkbox) ?
$set($col, now()->format('Y-m-d H:i:s')) : $set($col, null)
)
->formatStateUsing(function ($get) use ($col) {
return $get($col) ? true : false;
}),
DateTimePicker::make($col)
->timezone('Asia/Kuala_Lumpur')
->native(false)
->visible(function ($get, Model $record) use ($checkbox, $col) {
return $get($checkbox) || isset($record->fulfillment->$col);
}
)
->hiddenLabel(),
Checkbox::make($checkbox)
->reactive()
->dehydrated(false)
->afterStateUpdated(fn ($get, $set) => $get($checkbox) ?
$set($col, now()->format('Y-m-d H:i:s')) : $set($col, null)
)
->formatStateUsing(function ($get) use ($col) {
return $get($col) ? true : false;
}),
DateTimePicker::make($col)
->timezone('Asia/Kuala_Lumpur')
->native(false)
->visible(function ($get, Model $record) use ($checkbox, $col) {
return $get($checkbox) || isset($record->fulfillment->$col);
}
)
->hiddenLabel(),
1 replies
FFilament
Created by KeyMe on 11/16/2023 in #❓┊help
Datalist options using enum in PHP 8.1+
Anyone knows how to use enum as options for a datalist text input? Currently, datalist() method doesn't accept string like if we were to pass enum::class to option() method.
3 replies
FFilament
Created by KeyMe on 10/17/2023 in #❓┊help
Pass action form data to extra modal footer actions
I have a mountable action where i defined its form(), action(), and another action button defined in the extraModalFooterActions(). How do i pass the parent action's data array to the child action?
2 replies
FFilament
Created by KeyMe on 10/12/2023 in #❓┊help
Accessing reference to calling object from action class
I created an action class that extends the original action, override setUp(), and called it from a resource viewrecord page. How do i inject viewrecord instance so that I can call its' fillForm() to refresh the page once the action is performed? class ReviseUserDetail extends Actions\Action
protected function setUp(): void
{
parent::setUp();

$this
->form(OrderResource::getCustomerDetails())
->fillForm($this->record->attributesToArray())
->action(function (array $data): void {
$this->record->update($data);
Notification::make()
->title('Saved successfully!')
->success()
->send();
})
protected function setUp(): void
{
parent::setUp();

$this
->form(OrderResource::getCustomerDetails())
->fillForm($this->record->attributesToArray())
->action(function (array $data): void {
$this->record->update($data);
Notification::make()
->title('Saved successfully!')
->success()
->send();
})
6 replies
FFilament
Created by KeyMe on 9/18/2023 in #❓┊help
Listing multiple values for a relationship with another attribute
I have a vehicle relation manager table where i want to display every IMEI numbers associated with the vehicle. On top of that, I want to format the imei list to include its' type as below.
"0185701241241 (Device)
015830914194 (Addon)
"0185701241241 (Device)
015830914194 (Addon)
Current code, obviously doesnt work:
Tables\Columns\TextColumn::make('deviceimeis.imei')
->formatStateUsing(function ($state, Vehicle $record) {
return $state . '(' . $record->DeviceImeis->type . ')';
})
->label('IMEI')
->listWithLineBreaks()
->bulleted(),
Tables\Columns\TextColumn::make('deviceimeis.imei')
->formatStateUsing(function ($state, Vehicle $record) {
return $state . '(' . $record->DeviceImeis->type . ')';
})
->label('IMEI')
->listWithLineBreaks()
->bulleted(),
14 replies
FFilament
Created by KeyMe on 8/28/2023 in #❓┊help
Relation manager in action/modal
Curious, is it possible to display/edit relation manager in an action/modal instead?
16 replies
FFilament
Created by KeyMe on 8/14/2023 in #❓┊help
Relationship record not automatically created in resource View page action
I have an Order model with relationship of hasOne Training model. After order creation, there is an action modal in the ViewOrder page that prompt user to enter remarks. Upon action submission, I was hoping a related Training record would be created if not existed yet, else its remarks field should be updated but alas only updating existing record works. I've simplified the code below for review purpose.
Action::make('requestReviseOrder')
->form([
TextArea::make('remarks')
])
->action(function (array $data): void {
$this->record->training()- >update($data);
$this->fillForm();
}
Action::make('requestReviseOrder')
->form([
TextArea::make('remarks')
])
->action(function (array $data): void {
$this->record->training()- >update($data);
$this->fillForm();
}
Order class
public function training(): HasOne
{
return $this->hasOne(Training::class);
}
public function training(): HasOne
{
return $this->hasOne(Training::class);
}
Training class
public function order(): BelongsTo
{
return $this->belongsTo(Order::class);
}
public function order(): BelongsTo
{
return $this->belongsTo(Order::class);
}
7 replies
FFilament
Created by KeyMe on 8/2/2023 in #❓┊help
Only of the actions in ActionGroup can be opened
Post-upgrade v3, idk why but clicking an action one after another doesn't display the modal. I needed to refresh the page every time to open one
5 replies
FFilament
Created by KeyMe on 8/2/2023 in #❓┊help
Textinput mask class doesn't exist. Other way to implement money masking?
->mask(
fn (TextInput\Mask $mask) => $mask
->money(prefix: 'RM', thousandsSeparator: ',', decimalPlaces: 2)
)
->mask(
fn (TextInput\Mask $mask) => $mask
->money(prefix: 'RM', thousandsSeparator: ',', decimalPlaces: 2)
)
11 replies
FFilament
Created by KeyMe on 7/28/2023 in #❓┊help
Action modal form with many field to prefill
I have an action with modal form, initially i follow the documentation example to fill the form with default data, but now theres too many fields in the form, is there another way that gives less redundancy?
14 replies
FFilament
Created by KeyMe on 7/19/2023 in #❓┊help
CreateOptionForm in Repeater with dependent select component
I have a Repeater with dependent addon_name select field that ties to the addon_type field. Now I want users to be able to add new add-on name options to the list, like others, the problem is I didn't define the relationship() for the addon_name from the get-go. Bcs as you know I use the customization technique for the dependent name options. How do I go about this?
Select::make('addon_id')->label('Add-on Name')
->options(function (callable $get) {
$type = $get('type');

if (!$type) {
return Addon::pluck('name', 'id');
}
return Addon::where('type', $type)->pluck('name', 'id');
})
->searchable()
->reactive()
->createOptionForm([
Select::make('type')->label('Add-on Type')
->options(Addon::pluck('type', 'type'))
->placeholder('Select type')
->required(),
TextInput::make('name')->required()
])
->required(),
Select::make('addon_id')->label('Add-on Name')
->options(function (callable $get) {
$type = $get('type');

if (!$type) {
return Addon::pluck('name', 'id');
}
return Addon::where('type', $type)->pluck('name', 'id');
})
->searchable()
->reactive()
->createOptionForm([
Select::make('type')->label('Add-on Type')
->options(Addon::pluck('type', 'type'))
->placeholder('Select type')
->required(),
TextInput::make('name')->required()
])
->required(),
9 replies