rezabrnt
rezabrnt
FFilament
Created by rezabrnt on 1/12/2024 in #❓┊help
Add a button on the sidebar and on a widget
Can anyone help me with this please
3 replies
FFilament
Created by rezabrnt on 12/23/2023 in #❓┊help
Filter shown in vertical instead of horizontal
Thank you. All of your answers helped me
12 replies
FFilament
Created by rezabrnt on 12/23/2023 in #❓┊help
Filter shown in vertical instead of horizontal
here is the filter code I use
12 replies
FFilament
Created by rezabrnt on 12/23/2023 in #❓┊help
Filter shown in vertical instead of horizontal
Tables\Filters\Filter::make('created_at')
->form([
Forms\Components\DatePicker::make('created_from')
->placeholder(fn ($state): string => 'Dec 18, ' . now()->subYear()->format('Y')),
Forms\Components\DatePicker::make('created_until')
->placeholder(fn ($state): string => now()->format('M d, Y')),
])
->query(function (Builder $query, array $data): Builder {
return $query
->when(
$data['created_from'] ?? null,
fn (Builder $query, $date): Builder => $query->whereDate('created_at', '>=', $date),
)
->when(
$data['created_until'] ?? null,
fn (Builder $query, $date): Builder => $query->whereDate('created_at', '<=', $date),
);
})
->indicateUsing(function (array $data): array {
$indicators = [];
if ($data['created_from'] ?? null) {
$indicators['created_from'] = 'Dibuat dari ' . Carbon::parse($data['created_from'])->toFormattedDateString();
}
if ($data['created_until'] ?? null) {
$indicators['created_until'] = 'Order until ' . Carbon::parse($data['created_until'])->toFormattedDateString();
}

return $indicators;
}),
], layout: FiltersLayout::AboveContentCollapsible)->filtersFormColumns(3)
Tables\Filters\Filter::make('created_at')
->form([
Forms\Components\DatePicker::make('created_from')
->placeholder(fn ($state): string => 'Dec 18, ' . now()->subYear()->format('Y')),
Forms\Components\DatePicker::make('created_until')
->placeholder(fn ($state): string => now()->format('M d, Y')),
])
->query(function (Builder $query, array $data): Builder {
return $query
->when(
$data['created_from'] ?? null,
fn (Builder $query, $date): Builder => $query->whereDate('created_at', '>=', $date),
)
->when(
$data['created_until'] ?? null,
fn (Builder $query, $date): Builder => $query->whereDate('created_at', '<=', $date),
);
})
->indicateUsing(function (array $data): array {
$indicators = [];
if ($data['created_from'] ?? null) {
$indicators['created_from'] = 'Dibuat dari ' . Carbon::parse($data['created_from'])->toFormattedDateString();
}
if ($data['created_until'] ?? null) {
$indicators['created_until'] = 'Order until ' . Carbon::parse($data['created_until'])->toFormattedDateString();
}

return $indicators;
}),
], layout: FiltersLayout::AboveContentCollapsible)->filtersFormColumns(3)
12 replies
FFilament
Created by rezabrnt on 12/23/2023 in #❓┊help
Filter shown in vertical instead of horizontal
Both of them got spanned into 2 column
12 replies
FFilament
Created by rezabrnt on 12/23/2023 in #❓┊help
Filter shown in vertical instead of horizontal
No description
12 replies
FFilament
Created by rezabrnt on 12/23/2023 in #❓┊help
Filter shown in vertical instead of horizontal
No description
12 replies