H.Bilbao
H.Bilbao
FFilament
Created by H.Bilbao on 4/27/2024 in #❓┊help
Orderable column
Is it possible to pass a second parameter to orderable to order grouped by the second parameter? each group that has its order from 1 to X
7 replies
FFilament
Created by H.Bilbao on 3/27/2024 in #❓┊help
Widget chart between table filter date
How could I modify the start and end of the Trend of a Widget that is within a page, using the date filter selected in the table? Right now I have like this. But I need it to be from the date selected in the filter.
->between(
start: now()->startOfMonth(),
end: now()->endOfMonth()
)
->between(
start: now()->startOfMonth(),
end: now()->endOfMonth()
)
4 replies
FFilament
Created by H.Bilbao on 3/25/2024 in #❓┊help
Accessing page table data in the widget
I have a page with implements HasTable and I need the widget to be related to the table data. I have tried this option in the Panel Builder, but it doesn't work for me: https://filamentphp.com/docs/3.x/panels/resources/widgets#accessing-page-table-data-in-the-widget It gives me this error: Property [$activeTab] not found on component: [app.filament.pages.report] In the view I only have this
<x-filament-panels::page>
{{ $this->table }}
</x-filament-panels::page>
<x-filament-panels::page>
{{ $this->table }}
</x-filament-panels::page>
5 replies
FFilament
Created by H.Bilbao on 3/23/2024 in #❓┊help
FilterDatepicker with extraInputAttributes defaulta value
Hello, I have the following filter but it does not load any default values. `php Forms\Components\DatePicker::make('backup_month') ->extraInputAttributes(['type' => 'month']) ->afterStateUpdated(function ($livewire, string $state) { $this->filter = Carbon::parse($state); return $livewire->dispatch('refresh'); }) ->default(now()) ->live(onBlur: true)
2 replies
FFilament
Created by H.Bilbao on 3/17/2024 in #❓┊help
Question about tables
I have the following table. But I would like the backup_date to appear as a column and show the result of each server on each date. It's possible?
public function table(Table $table): Table
{
return $table
->query(Backup::query()
->select(
'backups.backup_date',
'backups.backup_status',
'backups.observations',
'servers.name as server_name'
)
->join('servers', 'backups.server_id', '=', 'servers.id'))
->columns([
Tables\Columns\TextColumn::make('server_name')
->sortable(),
Tables\Columns\TextColumn::make('backup_date'),
Tables\Columns\TextColumn::make('backup_status'),
])
->defaultSort('backup_date')
->paginated(false);
}
public function table(Table $table): Table
{
return $table
->query(Backup::query()
->select(
'backups.backup_date',
'backups.backup_status',
'backups.observations',
'servers.name as server_name'
)
->join('servers', 'backups.server_id', '=', 'servers.id'))
->columns([
Tables\Columns\TextColumn::make('server_name')
->sortable(),
Tables\Columns\TextColumn::make('backup_date'),
Tables\Columns\TextColumn::make('backup_status'),
])
->defaultSort('backup_date')
->paginated(false);
}
10 replies
FFilament
Created by H.Bilbao on 2/24/2024 in #❓┊help
DateTimePicker question
Hi, I have a DateTimePicker like this:
Forms\Components\DateTimePicker::make('start_time')
->format('Y-m-d H:i:s.v')
->step('.001'),

Model cast
'start_time' => 'datetime:Y-m-d H:i:s.v',
Forms\Components\DateTimePicker::make('start_time')
->format('Y-m-d H:i:s.v')
->step('.001'),

Model cast
'start_time' => 'datetime:Y-m-d H:i:s.v',
When I generate a new record, it is saved correctly and in the table, but when I open the form to edit by milliseconds it is not seen.
3 replies
FFilament
Created by H.Bilbao on 2/10/2024 in #❓┊help
Best practice to know if I'm in the resource or in the relationI have a form inside a resour manager
I have a form inside a resource that I use inside a relationship manager. I need to modify unique rule with modifyRuleUsing and for that I need to use the livewire component in the relation manager to get the resource ID and a select value in the resource. How do you know if I'm inside the resource or inside the relationship manager? Now I'm doing like this:
Forms\Components\TextInput::make('name')
->unique(ignoreRecord: true, modifyRuleUsing: function (Unique $rule, Get $get, Edition $edition, $livewire) {
$editionId = $livewire?->ownerRecord?->id ?? $get('edition_id');
return $rule->where('edition_id', $editionId);
})
->required(),
Forms\Components\TextInput::make('name')
->unique(ignoreRecord: true, modifyRuleUsing: function (Unique $rule, Get $get, Edition $edition, $livewire) {
$editionId = $livewire?->ownerRecord?->id ?? $get('edition_id');
return $rule->where('edition_id', $editionId);
})
->required(),
2 replies
FFilament
Created by H.Bilbao on 1/27/2024 in #❓┊help
Reuse form componenets
How can you reuse a section of components in several resources without having to paste the same code in all the resources?
4 replies
FFilament
Created by H.Bilbao on 11/6/2023 in #❓┊help
Fill select and select a value with afterStateUpdated
I have tried this, but with a select it does not work correctly: https://filamentphp.com/docs/3.x/forms/advanced#generating-a-slug-from-a-title I attach code:
Forms\Components\Select::make('customer_id')
->relationship('customer', 'name')
->afterStateUpdated(fn (string $operation, Forms\Set $set) => $operation === 'create' ? $set('requested_by', auth()->user()->id) : null)
->searchable()
->required()
->preload()
->live(),

Forms\Components\Select::make('requested_by')
->relationship('requestedBy', 'name', fn (Builder $query, Get $get) => $query->requestTicket($get('customer_id')))
->required(),
Forms\Components\Select::make('customer_id')
->relationship('customer', 'name')
->afterStateUpdated(fn (string $operation, Forms\Set $set) => $operation === 'create' ? $set('requested_by', auth()->user()->id) : null)
->searchable()
->required()
->preload()
->live(),

Forms\Components\Select::make('requested_by')
->relationship('requestedBy', 'name', fn (Builder $query, Get $get) => $query->requestTicket($get('customer_id')))
->required(),
4 replies
FFilament
Created by H.Bilbao on 10/27/2023 in #❓┊help
Get hiddenOn field value when mutate
How could I get the value of a conditionally hidden field? When it is visible, with $get I can get the value, but when it is hidden it returns null
5 replies
FFilament
Created by H.Bilbao on 10/26/2023 in #❓┊help
iconButton problems after update to 3.0.84
No description
12 replies
FFilament
Created by H.Bilbao on 10/24/2023 in #❓┊help
RepeatableEntry doubt
Would it be possible in the infolist, in the RepeatableEntry, to show the label of each column only in the head? Without having to repeat the labels for each record?
2 replies
FFilament
Created by H.Bilbao on 10/18/2023 in #❓┊help
Many queries when activate the defaultGroup
No description
6 replies
FFilament
Created by H.Bilbao on 10/18/2023 in #❓┊help
Resource repeater save record field inside relation manager
Hello, I have a resource with a repeater. Inside the repeater I have a field that I save using mutate:
->mutateRelationshipDataBeforeCreateUsing(function (array $data, Get $get): array {
$data['ticket_id'] = $get('ticket_id');
return $data;
})
->mutateRelationshipDataBeforeCreateUsing(function (array $data, Get $get): array {
$data['ticket_id'] = $get('ticket_id');
return $data;
})
Now I want to use the resource within a relationship manager, but I don't know how to pass the ticket_id, currently it gives an error that it cannot be null.
2 replies
FFilament
Created by H.Bilbao on 10/12/2023 in #❓┊help
Secure resource custom page
How can I secure a custom page within a resource for users who do not have a specific permission? I have hidden the action button with this, but if I type the URL of the custom page enters without problems: https://filamentphp.com/docs/3.x/actions/trigger-button#authorization
5 replies
FFilament
Created by H.Bilbao on 10/12/2023 in #❓┊help
Filter above custom page HasTable
How can I place filters above the table on a custom page? I tried these two but it doesn't work:
use Filament\Tables\Enums\FiltersLayout;

protected function getTableFiltersLayout(): FiltersLayout
{
return FiltersLayout::AboveContent;
}
use Filament\Tables\Enums\FiltersLayout;

protected function getTableFiltersLayout(): FiltersLayout
{
return FiltersLayout::AboveContent;
}
and
protected function getFiltersLayout(): FiltersLayout
{
return FiltersLayout::AboveContentCollapsible;
}
protected function getFiltersLayout(): FiltersLayout
{
return FiltersLayout::AboveContentCollapsible;
}
11 replies
FFilament
Created by H.Bilbao on 10/9/2023 in #❓┊help
Show only table options in the filter
I have a table where I have modified the getEloquentQuery and in the active filters I want to show only the options that I show in the table. Example, in the customers table I can have options that I am not showing in the order resource, how can I only show the options displayed in the table?
6 replies
FFilament
Created by H.Bilbao on 10/3/2023 in #❓┊help
Filter not working when modify getEloquentQuery with where o whereBelongsTo
If I modify the filters stop working
4 replies
FFilament
Created by H.Bilbao on 10/2/2023 in #❓┊help
Get current form values
How can I get a value from the form to pass to the relationship manager?
public static function getRelations(): array
{
return [
EmployeesRelationManager::make([
'employeeId' => .....,
]),
];
}
public static function getRelations(): array
{
return [
EmployeesRelationManager::make([
'employeeId' => .....,
]),
];
}
10 replies
FFilament
Created by H.Bilbao on 9/30/2023 in #❓┊help
Create action when viewing resource record
Would it be possible to activate CreateAction in a Relation Manager when viewing a resource record? It is activated when editing the resource, but I am interested in view form, because not all users have the option to edit the resource but they have the option to create records in the relationship manager.
4 replies