Carlos
Carlos
FFilament
Created by Carlos on 11/25/2024 in #❓┊help
CheckboxList not working on Edit
Hello, I have this Checkbox list field that depends of the value of another field:
Forms\Components\CheckboxList::make('countries')
->relationship('countries', 'name')
->visible(fn (Get $get) => $get('applies_to_relationship') === 'countries'),
Forms\Components\CheckboxList::make('countries')
->relationship('countries', 'name')
->visible(fn (Get $get) => $get('applies_to_relationship') === 'countries'),
` And in my model I have this relationship:
public function countries(): BelongsToMany
{
return $this->belongsToMany(Country::class, 'countries_campaigns', 'campaigns_id', 'countries_id');
}
public function countries(): BelongsToMany
{
return $this->belongsToMany(Country::class, 'countries_campaigns', 'campaigns_id', 'countries_id');
}
When I create a resource it works, and saves the related records, but when I try to edit a record it doesn't store the changes and wipes out any previous related record. How can I address this? Thank you
3 replies
FFilament
Created by Carlos on 9/16/2024 in #❓┊help
Spatie Media Library grid columns
No description
3 replies
FFilament
Created by Carlos on 6/7/2024 in #❓┊help
Get Collection from related model using Spatie Media Library plugin
Hello, in my project we use spatie media library to manage media files, let's say that I have 2 models and one belongsTo the other: Hotel and Room, Hotel has a media collection, i.e. "hotel_photos". What approach do I need to display the "hotel_photos" in the HouseResource form? the component SpatieMediaLibraryFileUpload only retrieves collections that belongs to the $record. Thanks.
3 replies
FFilament
Created by Carlos on 5/9/2024 in #❓┊help
Conditionally rendering an icon in TextColumn
I have a situation where the value of a cell could be "true" or anything else. How can I render an icon instead of text in a TextColumn, I tried this but it didn't work:
Tables\Columns\TextColumn::make('value')
->formatStateUsing( fn($state) => $state === 'true' ? new HtmlString(Blade::render('<x-filament::icon icon="heroicon-o-check" class="w-4 h-4"/>')) : $state ),
Tables\Columns\TextColumn::make('value')
->formatStateUsing( fn($state) => $state === 'true' ? new HtmlString(Blade::render('<x-filament::icon icon="heroicon-o-check" class="w-4 h-4"/>')) : $state ),
Thanks!
6 replies