Augus
Augus
FFilament
Created by Augus on 9/12/2024 in #❓┊help
Sorting ignores relation condition
But this way i can have proper multiple count tables :
Tables\Columns\TextColumn::make('active_not_castrated_animals_count')
->counts('active_not_castrated_animals')
->sortable()
->label('Aantal actieve dieren (excl. hamel)'),
Tables\Columns\TextColumn::make('animals_count')
->label('Totaal aantal dieren')
->sortable()
->counts('animals'),
Tables\Columns\TextColumn::make('active_not_castrated_animals_count')
->counts('active_not_castrated_animals')
->sortable()
->label('Aantal actieve dieren (excl. hamel)'),
Tables\Columns\TextColumn::make('animals_count')
->label('Totaal aantal dieren')
->sortable()
->counts('animals'),
22 replies
FFilament
Created by Augus on 9/12/2024 in #❓┊help
Sorting ignores relation condition
Not sure if this is the proper way to go but it works
22 replies
FFilament
Created by Augus on 9/12/2024 in #❓┊help
Sorting ignores relation condition
And this as a field:
Tables\Columns\TextColumn::make('active_not_castrated_animals_count')
->counts('active_not_castrated_animals')
->sortable()
->label('Aantal actieve dieren (excl. hamel)'),
Tables\Columns\TextColumn::make('active_not_castrated_animals_count')
->counts('active_not_castrated_animals')
->sortable()
->label('Aantal actieve dieren (excl. hamel)'),
22 replies
FFilament
Created by Augus on 9/12/2024 in #❓┊help
Sorting ignores relation condition
public function active_not_castrated_animals()
{
return $this->animals()->where([
'active' => true,
'castrated' => false,
]);
}
public function active_not_castrated_animals()
{
return $this->animals()->where([
'active' => true,
'castrated' => false,
]);
}
22 replies
FFilament
Created by Augus on 9/12/2024 in #❓┊help
Sorting ignores relation condition
Yea with a function withing my Model:
22 replies
FFilament
Created by Augus on 9/12/2024 in #❓┊help
Sorting ignores relation condition
22 replies
FFilament
Created by Augus on 9/12/2024 in #❓┊help
Sorting ignores relation condition
per documentation @CodeWithDennis
In this example, users is the name of the relationship to count from. The name of the column must be users_count, as this is the convention that Laravel uses for storing the result.
In this example, users is the name of the relationship to count from. The name of the column must be users_count, as this is the convention that Laravel uses for storing the result.
22 replies
FFilament
Created by Augus on 9/12/2024 in #❓┊help
Sorting ignores relation condition
This one needs to have the 'animals_count' name
22 replies
FFilament
Created by Augus on 9/12/2024 in #❓┊help
Sorting ignores relation condition
TextColumn::make('animals_count')->counts([
'animals' => fn (Builder $query) => $query->where('active', true),
])
TextColumn::make('animals_count')->counts([
'animals' => fn (Builder $query) => $query->where('active', true),
])
22 replies
FFilament
Created by Augus on 9/12/2024 in #❓┊help
Sorting ignores relation condition
It's not really an elegant solution but so far it does work
22 replies
FFilament
Created by Augus on 9/12/2024 in #❓┊help
Sorting ignores relation condition
This made me think, i am able to add another scoped relation in my model: Model:
public function active_animals()
{
return $this->animals()->where('active', true);
}
public function active_animals()
{
return $this->animals()->where('active', true);
}
Table:
Tables\Columns\TextColumn::make('active_animals_count')
->counts('active_animals')
->sortable()
->label('Aantal actieve dieren'),
Tables\Columns\TextColumn::make('active_animals_count')
->counts('active_animals')
->sortable()
->label('Aantal actieve dieren'),
22 replies
FFilament
Created by Augus on 9/12/2024 in #❓┊help
Sorting ignores relation condition
You must name the column 'animals_count' but in FIlament you can't have two columns having the same name
22 replies
FFilament
Created by Augus on 9/12/2024 in #❓┊help
Sorting ignores relation condition
Tables\Columns\TextColumn::make('animals_count')
->counts([
'animals' => fn (Builder $query): Builder => $query->where('active', true),
])
->sortable()
->label('Aantal actieve dieren'),
Tables\Columns\TextColumn::make('animals_count')
->counts([
'animals' => fn (Builder $query): Builder => $query->where([
'active' => true,
'castrated' => false,
'gender' => 'M',
]),
])
->sortable()
->label('Aantal actieve dieren excl. hamel'),
Tables\Columns\TextColumn::make('animals_count')
->counts([
'animals' => fn (Builder $query): Builder => $query->where('active', true),
])
->sortable()
->label('Aantal actieve dieren'),
Tables\Columns\TextColumn::make('animals_count')
->counts([
'animals' => fn (Builder $query): Builder => $query->where([
'active' => true,
'castrated' => false,
'gender' => 'M',
]),
])
->sortable()
->label('Aantal actieve dieren excl. hamel'),
22 replies
FFilament
Created by Augus on 9/12/2024 in #❓┊help
Sorting ignores relation condition
@CodeWithDennis that solution makes it that im unable to add multiple counts on the same table
22 replies
FFilament
Created by Augus on 7/31/2024 in #❓┊help
Add shared data to Infolist Livewire fields
Thanks alot
25 replies
FFilament
Created by Augus on 7/31/2024 in #❓┊help
Add shared data to Infolist Livewire fields
No problem, youve been a great help
25 replies
FFilament
Created by Augus on 7/31/2024 in #❓┊help
Add shared data to Infolist Livewire fields
Thanks to you @awcodes , you just gave me the insights to look a bit deeper <#
25 replies
FFilament
Created by Augus on 7/31/2024 in #❓┊help
Add shared data to Infolist Livewire fields
This works
25 replies
FFilament
Created by Augus on 7/31/2024 in #❓┊help
Add shared data to Infolist Livewire fields
public static function infolist(Infolist $infolist): Infolist
{
$record = $infolist->getRecord();
public static function infolist(Infolist $infolist): Infolist
{
$record = $infolist->getRecord();
25 replies
FFilament
Created by Augus on 7/31/2024 in #❓┊help
Add shared data to Infolist Livewire fields
I got it 😮
25 replies