dyo
Optimize duplicate queries in 2 method at the same TextColumn Class
Can someone help me to optimize with this case,
TextColumn::make('jenisDonasi.nama_jenis')
->tooltip(function ($record) {
if ($record->campaign) {
return 'Campaign: ' . $record->campaign->judul;
}
})
->description(function ($record) {
if ($record->campaign) {
return 'Lihat campaign';
}
})
The $record->campaign is a belongsTo relationship query, which is duplicate.
How can I execute only one $record->campaign to both method above in TextColumn?
10 replies
Problems in duplicate query detected at debugbar
Here's a table action I'm using, with some conditions to be visible
Action::make('verifikasi')
->icon('heroicon-o-magnifying-glass')
->visible(function ($record) {
if (
$record->trans_ref != null
&& in_array($record->status_konf, ['Baru', 'Pending', 'Cek Lagi'])
) {
return Setoran::unconfirm()
->where('rekening_id', $record->rekening_id)
->whereDate('tanggal', '>=', date('Y-m-d', strtotime($record->tanggal)))
->where('dana', $record->dana)
->exists();
}
})
The problem is, why the query of model Setoran above is detected duplicate or executed twice in debugbar queries tab?
The conditions above is only met in one record at the table.
I hope someone can explain me what's wrong.
2 replies
Problem in modal form
Action::make('import')
->form([
FileUpload::make('upload'),
])
->action(function (array $data) {
Excel::import(new DistribusiFirstSheet, $data['upload']);
}),
I want to create a modal form with FileUpload in it, but when i submit the uploaded form i got error:
Illuminate \ Contracts \ Filesystem \ FileNotFoundException
What did I miss?
9 replies
Set dependant value of Datepicker in form() Filter
In table filter class, how can I set other Filter form based on other value?
In my example, if konfirmasi_hari_ini is checked, then the value of filter ['tanggal']['from'] and ['tanggal']['until'] is set to now()
3 replies
Problem with formatStateUsing in TextColumn of custom table attribute
I just upgrading filament v2 to v3, but I got issue in textcolumn class with formatStateUsing method..
The qty attribute is not in table schema..
I need extra column to show the custom query..
In v2, the code above is working, but in v3, the column is returned blank..
What should I do to make it work in v3?
9 replies
Reset stat overview widget data in custom page
I'm using filament table in custom page, with stat overview above the table and using InteractsWithPageTable in the widget class.
I also using a custom filter, not filament table filter.
After submitting the filter, I called $this->resetTable() to apply the filter.
My question is, how can I also reset the widget data?
3 replies