F
Filament8mo ago
Sidem

diplay columnspan

Hi, I would like to put my filter in 1 line but i don't know how i have to do that :
Filter::make('created_at')
->form([
Forms\Components\DatePicker::make('created_from')->label('Créé depuis')->columnspan(1),
Forms\Components\DatePicker::make('created_until')->label('Créé jusqu\'à')->columnspan(1),
])
->query(function (Builder $query, array $data): Builder {
if (isset($data['created_from'])) {
$query->when(
$data['created_from'],
fn (Builder $query, $date): Builder => $query->whereDate('created_at', '>=', $date),
);
}

if (isset($data['created_until'])) {
$query->when(
$data['created_until'],
fn (Builder $query, $date): Builder => $query->whereDate('created_at', '<=', $date),
);
}

return $query;
})
->default()
->columnspan(1),
Filter::make('created_at')
->form([
Forms\Components\DatePicker::make('created_from')->label('Créé depuis')->columnspan(1),
Forms\Components\DatePicker::make('created_until')->label('Créé jusqu\'à')->columnspan(1),
])
->query(function (Builder $query, array $data): Builder {
if (isset($data['created_from'])) {
$query->when(
$data['created_from'],
fn (Builder $query, $date): Builder => $query->whereDate('created_at', '>=', $date),
);
}

if (isset($data['created_until'])) {
$query->when(
$data['created_until'],
fn (Builder $query, $date): Builder => $query->whereDate('created_at', '<=', $date),
);
}

return $query;
})
->default()
->columnspan(1),
2 Replies
NolanN
NolanN8mo ago
You've set the column span of the inputs to 1 but you haven't set the form to have 2 columns yet. Try changing the last columnspan(1) method call in your example to columns(2)
Sidem
SidemOP8mo ago
Ok thanks but the diplay are not the same :
No description
Want results from more Discord servers?
Add your server