justlasse
justlasse
FFilament
Created by DrByte on 1/13/2024 in #❓┊help
Tracking Read/Unread or Viewed/NotViewed
Why not make it a relationship and use that to create views $this->views()->create()
9 replies
FFilament
Created by D2RTECH on 1/8/2024 in #❓┊help
how to show the mobile number with country code
How are you storing them in the db or model?
8 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
Even better! Thanks for adding that
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
->icon(fn(Story $state) => match($state->status){
StoryStatusEnum::Accepted => 'heroicon-s-heart',
StoryStatusEnum::Completed => 'heroicon-m-fire',
StoryStatusEnum::FactReview, StoryStatusEnum::AccuracyReview => 'heroicon-m-chat-bubble-bottom-center',
default => 'heroicon-s-currency-dollar'
})
->icon(fn(Story $state) => match($state->status){
StoryStatusEnum::Accepted => 'heroicon-s-heart',
StoryStatusEnum::Completed => 'heroicon-m-fire',
StoryStatusEnum::FactReview, StoryStatusEnum::AccuracyReview => 'heroicon-m-chat-bubble-bottom-center',
default => 'heroicon-s-currency-dollar'
})
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
You can inject a model in my instance Story to the function, but you have to call it $state or it doesn't seem to work.
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
for example
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
->icon(fn($state) => match($state->status){
StoryStatusEnum::Accepted => 'heroicon-s-heart',
StoryStatusEnum::Completed => 'heroicon-m-fire',
StoryStatusEnum::FactReview, StoryStatusEnum::AccuracyReview => 'heroicon-m-chat-bubble-bottom-center',
default => 'heroicon-s-currency-dollar'
})
->icon(fn($state) => match($state->status){
StoryStatusEnum::Accepted => 'heroicon-s-heart',
StoryStatusEnum::Completed => 'heroicon-m-fire',
StoryStatusEnum::FactReview, StoryStatusEnum::AccuracyReview => 'heroicon-m-chat-bubble-bottom-center',
default => 'heroicon-s-currency-dollar'
})
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
No description
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
If you want more colors you can just make it a match statement to return multiple results and a default.
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
NICE!
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
TextColumn::make('authoredStories')->badge()->formatStateUsing(fn($state) => $state->name)->color(fn(User $record, $state) => $state->completed ? 'success': 'primary'),
TextColumn::make('authoredStories')->badge()->formatStateUsing(fn($state) => $state->name)->color(fn(User $record, $state) => $state->completed ? 'success': 'primary'),
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
This actually worked in the textcolumn, no custom column needed
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
No description
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
So perhaps if you format the state and use commercial_name, but use the actual schools relation in the make, you'd have access to the current school object
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
that returns the current badge "school" in your instance
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
You can inject $state in the color function
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
@if ($isBadge)
<x-filament::badge
:color="$color"
:icon="$icon"
:icon-position="$iconPosition"
>
{{ $formattedState }}
</x-filament::badge>
@else
@if ($isBadge)
<x-filament::badge
:color="$color"
:icon="$icon"
:icon-position="$iconPosition"
>
{{ $formattedState }}
</x-filament::badge>
@else
Here is the problem that you're up against in the textcolumn....
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
You could use the badge component in a custom column perhaps?
37 replies
FFilament
Created by karim charfaoui on 1/7/2024 in #❓┊help
How to set badge color from relation
Since the textcolumn assumes 1 value
37 replies