lbar
lbar
FFilament
Created by lbar on 1/3/2025 in #❓┊help
modal form passing value from the action
In my view I have the following action:
{{ ($this->subscribeMemberAction)(['member_id' => $member->id]) }}
{{ ($this->subscribeMemberAction)(['member_id' => $member->id]) }}
this work pretty well, and I'm able to fetch my data from fillForm on the component:
return Action::make('subscribeMember')
->fillForm(function (array $arguments){
return Member::where('id', '=', $arguments['member_id'])->first()->toArray();
)
[...]
return Action::make('subscribeMember')
->fillForm(function (array $arguments){
return Member::where('id', '=', $arguments['member_id'])->first()->toArray();
)
[...]
but I need to pre-fetch some options (extracting them from database) using the same $arguments['member_id']. So something like this, but here the $arguments is not available
[...]
->schema([
Radio::make('member_certificates')
->options(function ($arguments){
// here $arguments['member_id'] is not available
return MemberCertificate::where('member_id', '=', $arguments['member_id'])->pluck('id','expire_Date')->toArray();
})
])
[...]
[...]
->schema([
Radio::make('member_certificates')
->options(function ($arguments){
// here $arguments['member_id'] is not available
return MemberCertificate::where('member_id', '=', $arguments['member_id'])->pluck('id','expire_Date')->toArray();
})
])
[...]
Any clue on how to archive that? Thank you
20 replies
FFilament
Created by lbar on 12/12/2024 in #❓┊help
breadcrumb never disappear completely
No description
5 replies
FFilament
Created by lbar on 11/11/2024 in #❓┊help
DatePicker problem accessing the field from the relationship
I'm struggling with this specific problem on DatePicker, so as last resort i'm trying to write there. Basically I have a birth_date (type date) field on the sql. I'm accessing this field on two different resource. The first one is the resource itself of the table, and works correctly:
Forms\Components\DatePicker::make('birth_date')
->translateLabel()
->required(),
Forms\Components\DatePicker::make('birth_date')
->translateLabel()
->required(),
the DatePicker is correctly populated with the date that I have on the database. The second one give the problems:
Grid::make()
->relationship('mainMember')
->schema([
[...]
Forms\Components\DatePicker::make('birth_date')
->translateLabel()
->required(),
Grid::make()
->relationship('mainMember')
->schema([
[...]
Forms\Components\DatePicker::make('birth_date')
->translateLabel()
->required(),
The relation on the model is that one:
public function mainMember(): HasOne
{
return $this->hasOne(Member::class)->where('is_main', 1);
}
public function mainMember(): HasOne
{
return $this->hasOne(Member::class)->where('is_main', 1);
}
If I compare the date on both field (working/no-working, dumping the value on formatStateUsing) i have the exaclty date:
working -> 2020-12-25T00:00:00.000000Z
no working -> 2020-12-25T00:00:00.000000Z
working -> 2020-12-25T00:00:00.000000Z
no working -> 2020-12-25T00:00:00.000000Z
There is some hero that can understand what I wrong? ty
4 replies
FFilament
Created by lbar on 10/30/2024 in #❓┊help
NavigationGroup translate and icons
I'm struggling with the translation of NavigationGroup. Basically what i'm going to do is:
->navigationGroups([
NavigationGroup::make(__('contests.races'))
->icon('heroicon-s-squares-plus')
->collapsed(),
[...]
->navigationGroups([
NavigationGroup::make(__('contests.races'))
->icon('heroicon-s-squares-plus')
->collapsed(),
[...]
and then in the related resource:
[...]
public static function getNavigationGroup(): ?string
{
return __('contests.races');
}
[...]
[...]
public static function getNavigationGroup(): ?string
{
return __('contests.races');
}
[...]
and works. But for I reason that i don't known and that drive me crazy, the ->icon('heroicon-s-squares-plus') is visible only on one translation, and not on the others. It's just me that i wrong something, or is a kind of bug? ty
3 replies
FFilament
Created by lbar on 10/4/2024 in #❓┊help
alignment in panel
No description
3 replies
FFilament
Created by lbar on 10/2/2024 in #❓┊help
extraAttributes add class on Section seems not works
hi! actually i have a form section like this:
Section::make()
->description('Main Contact Referent')
->relationship('user')
->schema([
TextInput::make('firstname')
->label('First Name')
->formatStateUsing(fn($record) => $record->mainMember ? $record->mainMember->firstname : null)
->disabled(),
TextInput::make('lastname')
->label('Last Name')
->formatStateUsing(fn($record) => $record->mainMember ? $record->mainMember->lastname : null)
->disabled(),
TextInput::make('tax_code')
->label('Tax Code')
->disabled(),
])
->collapsed()
->extraAttributes(['class' => 'bg-neutral-950']),
Section::make()
->description('Main Contact Referent')
->relationship('user')
->schema([
TextInput::make('firstname')
->label('First Name')
->formatStateUsing(fn($record) => $record->mainMember ? $record->mainMember->firstname : null)
->disabled(),
TextInput::make('lastname')
->label('Last Name')
->formatStateUsing(fn($record) => $record->mainMember ? $record->mainMember->lastname : null)
->disabled(),
TextInput::make('tax_code')
->label('Tax Code')
->disabled(),
])
->collapsed()
->extraAttributes(['class' => 'bg-neutral-950']),
the class added on the html appear correctly, but nothing change from the rendered html. I basically want change a background for a specific section of this form. Is that a correct approach? ty
8 replies