wyChoong
wyChoong
FFilament
Created by wyChoong on 2/2/2024 in #❓┊help
adding alpinejs plugin into panel
Is there any article/doc about adding alpinejs plugins into filament app(not plugin), ideally to be able to lazy load
11 replies
FFilament
Created by wyChoong on 1/10/2024 in #❓┊help
how to use Action button to trigger js
How can I use Action to run js?
16 replies
FFilament
Created by wyChoong on 11/17/2023 in #❓┊help
Actions button omit stating `->action(function_name)`
the question is, is it possible to omit stating ->action(function_name) and have the function called automatically? is it not possible or I missed out in the doc very often I have action buttons in page/form and is defined as below
protected function getFormActions(): array
{
return [
$this->getSaveFormAction(),
Action::make('approve')
->action('approve'),
Action::make('reject')
->action('reject')
];
}
protected function getFormActions(): array
{
return [
$this->getSaveFormAction(),
Action::make('approve')
->action('approve'),
Action::make('reject')
->action('reject')
];
}
and have the functions defined as
public function approve()
{
//
}

public function reject()
{
//
}
public function approve()
{
//
}

public function reject()
{
//
}
4 replies
FFilament
Created by wyChoong on 11/8/2023 in #❓┊help
how to identify which button triggered action in single form with multiple buttons
I have a resource that in edit page
Forms\Components\TextInput::make('reference')
->unique(ignoreRecord: true, modifyRuleUsing: function (Unique $rule, $get) {
return $rule->where('status', 'approved');
})
Forms\Components\TextInput::make('reference')
->unique(ignoreRecord: true, modifyRuleUsing: function (Unique $rule, $get) {
return $rule->where('status', 'approved');
})
I added an additional action
protected function getFormActions(): array
{
return [
$this->getSaveFormAction()
->label('Approve')
->color('success'),
Action::make('reject')
->action('reject')
->color('warning')
->label('Reject'),
$this->getCancelFormAction(),
];
}

public function reject()
{
$data = $this->form->getState();
// ...
}
protected function getFormActions(): array
{
return [
$this->getSaveFormAction()
->label('Approve')
->color('success'),
Action::make('reject')
->action('reject')
->color('warning')
->label('Reject'),
$this->getCancelFormAction(),
];
}

public function reject()
{
$data = $this->form->getState();
// ...
}
now the question is, if the record that I'm going to reject, I don't need the to validate the uniqueness of the reference field, how can I achieve this
4 replies
FFilament
Created by wyChoong on 10/16/2023 in #❓┊help
using associative array for table/form schema array
is there any concern in using associative array for form/table schema, eg:
// default form schema
function defaultRegistrationForm(){
return [
'name' => TextInput::make('name'),
'email' => TextInput::make('email'),
];
}

function getRegistrationFormSchema(){
// handle form schema customization
}

// form
$form->schema($this->getRegistrationFormSchema())
// default form schema
function defaultRegistrationForm(){
return [
'name' => TextInput::make('name'),
'email' => TextInput::make('email'),
];
}

function getRegistrationFormSchema(){
// handle form schema customization
}

// form
$form->schema($this->getRegistrationFormSchema())
and then I will have some api to customize the schema fields, eg:
RegistrationForm::add(fn() => ['mobile' => TextInput::make('mobile'));
RegistrationForm::before('name', ['salutation => ...]);
RegistrationForm::add(fn() => ['mobile' => TextInput::make('mobile'));
RegistrationForm::before('name', ['salutation => ...]);
this may also extend to any methods in filament that return array such as getHeaderActions array etc is this a pattern that Filament would advise against with?
7 replies
FFilament
Created by wyChoong on 9/9/2023 in #❓┊help
registering widgets
so i have created a widget for a resource, in the doc it mentioned to register the widget in Resource and also the page. my question is , is it compulsory to register both or just the resource page is enough? currently I'm just registering in the View page and it seems to work, is there anything I'm missing? why should we register in Resource also?
2 replies
FFilament
Created by wyChoong on 8/28/2023 in #❓┊help
how to eager load in relationship manager
7 replies
FFilament
Created by wyChoong on 8/14/2023 in #❓┊help
Panels visibility
I have this use case where I would want to setup the panels in such way: 1) have multiple panels but not all users should see all the panels 2) when login, they should use /login instead of /{panel}/login, it will bring them to panel they have access after login what api can I use to configure?
17 replies
FFilament
Created by wyChoong on 7/31/2023 in #❓┊help
using form in tab with relation manager
i have this use case where for a resource with relation manager to display related models in table. now would like to add a Tab to have a form. how can i achieve that?
10 replies
FFilament
Created by wyChoong on 7/24/2023 in #❓┊help
built in Widgets not configurable
widget's props are protected and there is no way to configure it
protected static bool $isLazy = true;

protected static ?int $sort = null;
protected static bool $isLazy = true;

protected static ?int $sort = null;
of course we can just extend it, but if there is an api like configureUsing it will be helpful and benefits plugins developer to provide customization
14 replies
FFilament
Created by wyChoong on 7/5/2023 in #❓┊help
fields with filepond load the entire files from server
When displaying fields with filepond in Edit/View page, the entire file is loaded, this could be problematic: - none previewable file, eg: pdf, only loading the file to display file size - waste of bandwidth can the field to be enhanced to mock the file if its not image/* ? https://pqina.nl/filepond/docs/api/instance/properties/#files:~:text=You%20can%20also,the%20file%20data.
1 replies