potz1024
potz1024
FFilament
Created by potz1024 on 2/20/2025 in #❓┊help
Unique filters for same table in multiple locations
Hi all, I have a resource, lets say Product, which has a reasonably developed table, with a few columns with added descriptions, badge columns, filters etc.. I have a second resource Order, and a single order may have multiple Products, so I created a RelationManager to list associated products on the Order resource page. All works fine. My only problem is that when viewing Products on an Order page, any filters which might have been applied when viewing Products on the Product page, are applied to the view on the Order page. So essentially my question is, is there away of applying filters uniquely, depending on where the table is displayed? :wq
5 replies
FFilament
Created by potz1024 on 2/17/2025 in #❓┊help
Relation Manager placement on resources
Hi all, I have a large database, which from a user/admin interface, is largely read only, there isn't a lot a user edits, the data mainly comes from remote feeds. I'm mainly building views with Infolists, and in order to organise the resource view, i'd like to be able to put different relation managers on different tabs.
However, I don't belive this is possible, or is it? I know I can implement a hasCombinedRelationManagerTabsWithContent function with the view file, but this simply makes every relationship a tab, rather than giving the flexibility to drop relations into sections or tabs. A specific example is a football fixture. On the first tab, I'd like basic data, league, date and time, teams, status etc.. Then on the next tab, I'd like events, each of which are relations, so we'd have goals relation, substitutions relation, bookings relation, corners relation etc.. Then on a third tab, another relation which is data feed log, and a forth tab relating to betting outcomes for the fixture, again another relation.
If I put all relations on a single page, it becomes quite cumbersome.
I don't know if there is a better approach to modelling resources with many relations, as view only? Any thoughts or advise grately recieved. TIA :wq
3 replies
FFilament
Created by potz1024 on 2/17/2025 in #❓┊help
HTML with colour in TextColumn description
Hi all, I've been working with Filament for a few days, looking to replace a Nova admin interface with something more flexible. I have a table, and in a column I wish to show a description under the main content, and depending on the value or attributes in the record I'm displaying, I want part of the text of the description to be coloured. I am trying to do this by wrapping the returned value for the description in an HtmlStrring, then applying tailwind classes to colour, but it isn't working.
I'm more a backend than frontend dev, but feel this is something to do with tailwind not picking up the classes. A simplified column definition is:
Tables\Columns\TextColumn::make("average_games")
->description(function (TeamSeasonStatistic $stat) {
return new HtmlString("$stat->value (<span class='text-danger-400'>{$stat->average}</span>)");
})
Tables\Columns\TextColumn::make("average_games")
->description(function (TeamSeasonStatistic $stat) {
return new HtmlString("$stat->value (<span class='text-danger-400'>{$stat->average}</span>)");
})
Note that
text-primary-400
text-primary-400
will work, but not
text-danger-400
text-danger-400
. In the full implementation, I would use a
match
match
or similar to use different colours depending on teh value. TIA :wq
9 replies