lacymj
lacymj
FFilament
Created by lacymj on 9/16/2024 in #❓┊help
Counting relationships
I have a simple relationship between an Entry and a Jockey. class Entry extends Model { public function jockey(): BelongsTo { return $this->belongsTo(Jockey::class); } } class Jockey extends Model { public function entries(): hasMany { return $this->hasMany(Entry::class); } } I created filament resources for both models and am trying to get the relationship counts on the table list. It works great on the JockeyResource with this: Tables\Columns\TextColumn::make('entries_count') ->label('Entry Count') ->counts('entries'), BUT, when I try to get the same entry count on the EntryResource using what I "think" should work: Tables\Columns\TextColumn::make('jockey.entries_count') ->label('Entry Count') ->counts('jockey.entries'), I get this error Call to undefined method App\Models\Entry::jockey.entries() What's interesting is that if I take off the count options and just do this: Tables\Columns\TextColumn::make('jockey.entries') ->label('Entry Count'), I get the entire Entry record for all the correct entries Any ideas how I can just get the count? I don't need the entire record returned.
16 replies
FFilament
Created by lacymj on 9/10/2024 in #❓┊help
How do I move custom NavigationItems to right side of Topbar?
This seems like it should be simple, but I'm struggling to find a way... I have 2 panels - guest and app that both use topbar navigation. The guest panel does not require authentication and I've added Login and Register NavigationItems that route to the app panel authentication. I just want to move them over to the right side of the topbar. I played around with renderHook for TOPBAR_END and can put links there, but I want the NavigationItems moved rather duplicating with a blade view. Thanks
8 replies