Barbaracrlp
widgetTable query
Hi I build a widget, and I only wanna show the last 5 rows of my table. I tried the limit in the query but it's not working.Keeps showing me everythig.
public function table(Table $table): Table
{
return $table
->heading('Pedidos')
->description('Los últimos pedidos')
->query(Album::query()->latest('fecha')->limit(5))
6 replies
Filter Indicator : Color
Hi I wanna know if there's any way to change the color of the FilterIndicator that I'm creatins with ->indicateUsing().
Filter::make('etiqueta')
->form([
Select::make('etiqueta')
->options(Etiqueta::all()->pluck('titulo', 'id')->toArray())
->native(false),
])
->query(function (Builder $query, array $data): Builder {
if (!empty($data['etiqueta'])) {
$etiquetaId = $data['etiqueta'];
return $query->whereHas('etiquetas', function (Builder $query) use ($etiquetaId) {
$query->where('id', $etiquetaId);
});
}
return $query;
})
->indicateUsing(function(array $data): ?string{
if(! $data['etiqueta']){
return null;
}
return 'fas-tag'.$data['etiqueta'];
}),
6 replies
Form Validation inside Action
Hi, I'm trying to add a simple form validation inside my 'delete action'.
I want to show a random number and the user to introduce the same to delete the record.
I've tried changing the modal view, but it justs keeps dee¡leting everything no matter the form: <
Tables\Actions\Action::make('Delete')
->label('Eliminar')
->color('danger')
->modalContent(fn (Pedido $record,): View => view(
'filament.actions.deletePedido',
['record' => $record, 'aleatorio' => rand(1000, 9999)],
))
->modalSubmitActionLabel('Eliminar')
->modalCancelActionLabel('Cancelar')
->color('danger')
->action(function (Pedido $record, Request $request) {
$userNum = $request->input('userNum');
error_log($userNum."el del susuario");
$aleatorio = $request->input('aleatorio');
error_log($aleatorio."el del susuario");
if ($userNum === $aleatorio) {
error_log("Se borra");
}
else{
error_log(" No Se borra");
}
})>
14 replies
Fontawesome Pro Not working
Hi Iu'm trying to use Fontawesome pro in my project, I follow the steps here: https://github.com/owenvoke/blade-fontawesome#font-awesome-pro but when I do the php artisan blade-fontawesome:sync-icons --pro it does nothing, it's already running (I believe) for almost 20 min but nothing. And now the icons I was using are not working anymore. I used free icons with the redirect methos in the provider. Any ideas?
2 replies
PAGE_START hook not working.
Hi, I'm trying to customize my login page, I tries rewriting the whole blade but it didn't work the way I wanted.So I'm trying with render hook. I found that PAGE_START /PAGE_END can be scoped. But in my case thay are not working.Any ideas?
FilamentView::registerRenderHook(
// PanelsRenderHook::AUTH_LOGIN_FORM_BEFORE,
PanelsRenderHook::PAGE_START,
fn():View=>view('extra_login_head'),
// scopes:\App\Filament\Pages\Auth\LoginEdit::class,
);
FilamentView::registerRenderHook(
// PanelsRenderHook::AUTH_LOGIN_FORM_AFTER,
PanelsRenderHook::PAGE_END,
fn():View=>view('extra_login_foot'),
// scopes:\App\Filament\Pages\Auth\LoginEdit::class,
);
It does not work with the scope neither.4 replies
using users from my DB
Hi, I'm trying to implement a dashboard in a DB that's already done,I can't change the structure how do I manage to use the users I already got in my DB instead of using filament users per se.
I was thinking on rewriting the $table property on the user model but I don't know if it will work
7 replies