H.Bilbao
H.Bilbao
FFilament
Created by H.Bilbao on 1/21/2025 in #❓┊help
Is posbile to have 2 tables inside one livewire component?
I have done some tests, but it shows me the same data in both tables:
class ListResults extends Component implements HasForms, HasTable
{
use InteractsWithTable;
use InteractsWithForms;

public function table(Table $table): Table
{
$query = Results::query()
->...........
return $table
->.......
}

public function totalResultsTable(Table $table): Table
{
$query = Ranking::query()
->................
return $table
->.........
}

public function render()
{
return view('livewire.list-results', [
'ResultsTable' => $this->table(Tables\Table::make($this)),
'totalResultsTable' => $this->totalResultsTable(Tables\Table::make($this))
]);
}
class ListResults extends Component implements HasForms, HasTable
{
use InteractsWithTable;
use InteractsWithForms;

public function table(Table $table): Table
{
$query = Results::query()
->...........
return $table
->.......
}

public function totalResultsTable(Table $table): Table
{
$query = Ranking::query()
->................
return $table
->.........
}

public function render()
{
return view('livewire.list-results', [
'ResultsTable' => $this->table(Tables\Table::make($this)),
'totalResultsTable' => $this->totalResultsTable(Tables\Table::make($this))
]);
}
Blade
<div class="w-full">
{{ $stageResultsTable }}
</div>

<div class="w-full">
{{ $totalResultsTable }}
</div>
<div class="w-full">
{{ $stageResultsTable }}
</div>

<div class="w-full">
{{ $totalResultsTable }}
</div>
Thanks
3 replies
FFilament
Created by H.Bilbao on 1/18/2025 in #❓┊help
ManageRelatedRecords widgets with table filter records
I have the following error:
Unable to resolve dependency [Parameter #0 [ <required> string|int $record ]] in class Filament\Resources\Pages\ManageRelatedRecords
Unable to resolve dependency [Parameter #0 [ <required> string|int $record ]] in class Filament\Resources\Pages\ManageRelatedRecords
In Page I have
use ExposesTableToWidgets;
use ExposesTableToWidgets;
And in the Widget:
use InteractsWithPageTable;
use InteractsWithPageTable;
And I use $this->getPageTableQuery()
4 replies
FFilament
Created by H.Bilbao on 1/12/2025 in #❓┊help
Update table actions when change filter
I need to change the visibility of the actions when I change the filter. I have the following code so that it is not calculating the state in each record, but it does not update the visibility of the button until I refresh with F5 or click any action. If I do the find on each record it generates a large number of unnecessary queries.
protected function getTableActions(): array
{
$this->initializePermissions();

// Retrieve the auth_status value
$legAuthStatus = $this->record->legs->find($this->getTableFilterState('leg')['value'])->auth_status ?? null;
$isNotOfficial = $legAuthStatus != EntryListEnum::Official;

return [
Tables\Actions\ViewAction::make()
->iconButton()
->modalWidth(MaxWidth::Medium),
Tables\Actions\EditAction::make()
->iconButton()
->modalWidth(MaxWidth::Medium)
->visible(fn($record, $livewire) => $this->canEditAuthorization && $isNotOfficial),
Tables\Actions\DeleteAction::make()
->iconButton()
->visible(fn($record, $livewire) => $this->canDeleteAuthorization && $isNotOfficial),
];
}
protected function getTableActions(): array
{
$this->initializePermissions();

// Retrieve the auth_status value
$legAuthStatus = $this->record->legs->find($this->getTableFilterState('leg')['value'])->auth_status ?? null;
$isNotOfficial = $legAuthStatus != EntryListEnum::Official;

return [
Tables\Actions\ViewAction::make()
->iconButton()
->modalWidth(MaxWidth::Medium),
Tables\Actions\EditAction::make()
->iconButton()
->modalWidth(MaxWidth::Medium)
->visible(fn($record, $livewire) => $this->canEditAuthorization && $isNotOfficial),
Tables\Actions\DeleteAction::make()
->iconButton()
->visible(fn($record, $livewire) => $this->canDeleteAuthorization && $isNotOfficial),
];
}
Thanks
2 replies
FFilament
Created by H.Bilbao on 12/22/2024 in #❓┊help
Summarize and visibleFrom possible bug?
No description
4 replies
FFilament
Created by H.Bilbao on 12/21/2024 in #❓┊help
Using filament styles outside of the resource
Hi, how can I use filament styles in my app.blade.php? I want to use tables, forms with livewire components but outside the panel and I don't know how to import the styles into app.blade.php. Currently I see the components but without any style.
4 replies
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