403gtfo
403gtfo
FFilament
Created by 403gtfo on 6/25/2024 in #❓┊help
Advanced Tables (Plugin) Example / advice.
I thought it might be best for me to put this in the help section and not just the community tab. is there a github repo showing some examples like for the demo? I've tried setting up filters on a table and all I want to do is say "For the Discipline filter, use the relation and a SELECT box". Clearly I am doing something wrong as it seems to preload this filter in when I hit reset. I only what the filter to appear when the user selects it. I am sure it is dead easy but I just missed it.
->filters([
AdvancedFilter::make()
->filterPickerSearch()
->filterPickerMaxHeight('240px')
->includeColumns()
->filters([
SelectFilter::make('discipline.name')
->relationship('discipline', 'name')
->multiple()
->preload(),
])
//
,
])
->filters([
AdvancedFilter::make()
->filterPickerSearch()
->filterPickerMaxHeight('240px')
->includeColumns()
->filters([
SelectFilter::make('discipline.name')
->relationship('discipline', 'name')
->multiple()
->preload(),
])
//
,
])
5 replies
FFilament
Created by 403gtfo on 5/13/2024 in #❓┊help
Noob question: Sorting a hasMany column in table
I'm really struggle sorry and I am sure it is dead easy to do. Apologies, I know I've asked a bunch of relation questions, but that seems to be where stuff explodes for me. What I am trying to do: I need the HIndex column in the Activities table to be sortable based on the related HIndex with the highest year value (or based on the formatted state would be even better) Model Activity: - has many HIndex via
public function hIndices()
{
return $this->hasMany(HIndex::class)->orderBy('year', 'desc');
}
public function hIndices()
{
return $this->hasMany(HIndex::class)->orderBy('year', 'desc');
}
Model HIndex : - Belongs to one Activity - Has the columns -- year -- value -- activity_id In the Activity resource I have:
TextColumn::make('hIndices.value')
->formatStateUsing(function ($record) {
// ... some stuff dont worry about it
}
->sortable(),
TextColumn::make('hIndices.value')
->formatStateUsing(function ($record) {
// ... some stuff dont worry about it
}
->sortable(),
But it throws: SQLSTATE[21000]: Cardinality violation: 1242 Subquery returns more than 1 row
3 replies
FFilament
Created by 403gtfo on 4/22/2024 in #❓┊help
is there a formatStateUsing for IconColumn?
What I have: I have a table with a one-to-many boolean icon column (positionData.is_active) Currently the State is populates with all the records for example (true, false, true) What I want to do: I just want a single value returned. What I have tried If it was a TextColumn I could use something like
TextColumn::make('positionData.is_active)
->formatStateUsing(
function ($record) {
$isActive = $record->positionData->sortByDesc('year')->values()->first()->is_active;
// render stuff here ...
}
TextColumn::make('positionData.is_active)
->formatStateUsing(
function ($record) {
$isActive = $record->positionData->sortByDesc('year')->values()->first()->is_active;
// render stuff here ...
}
But this doesnt seem to be a thing for IconColumns. I've tried using the
TextColumn::make('positionData.is_active)->icon(...)
TextColumn::make('positionData.is_active)->icon(...)
But the format and size is totally different than the Icon Columns. Any suggestions?
9 replies
FFilament
Created by 403gtfo on 2/12/2024 in #❓┊help
Global search box in filters draw.
Hey team, anyone know of a nice way to include a global search box in the filters panel on a table? I could manually write one but was wonding if anyone has a nice neat way of doing it?
2 replies
FFilament
Created by 403gtfo on 1/10/2024 in #❓┊help
3.1 Importer File type error
No description
19 replies
FFilament
Created by 403gtfo on 11/17/2023 in #❓┊help
getEloquentQuery() many to may relation multi row per attachment
I am trying to customize the query using getEloquentQuery() and am having trouble getting the query to return what I am after. Any help would be greatly appreciated, also if there is a better way please let me know. It may be more a eloquent help request than anything.
Setup: - Activity 1, Staff A, Staff B - Activity 2, Staff B What I need the query to return for me table: - Activity 1 Staff A - Activity 1 Staff B -Activity 2 Staff B There is a bunch of other joins and stuff I need to do based on the staff member thus I am try to use getEloquentQuery(). For the life of me I cant wrap my head around how I need to format it to make it work.
4 replies
FFilament
Created by 403gtfo on 11/7/2023 in #❓┊help
Help with creating a github bug ticket.
Sorry guys, I dont normally make bug tickets. I have tried making one twice now and the gitbot keeps closing it down claiming there is not repo provided... The first one that was true, but I couldn't seem to reopen it after updating it. The second one, just auto closed even when provided. It's not a big issue, and I could put in a hacky fix for myself, but I am just trying to assist in improvements. Any advice on how I was meant to format it or how I go about consensually stepping on the gitbot? Ticket: https://github.com/filamentphp/filament/issues/9517
9 replies