ZeroCharistmas
ZeroCharistmas
FFilament
Created by ZeroCharistmas on 7/10/2024 in #❓┊help
Repeater not saving pivot relationship
I've been searching the docs, the filament repo, and discord all day and have found people with similar issues, but none of the fixes are working. For some reason the repeater data just will not save. The repeater is defined as:
Repeater::make('userEvents')
->relationship()
->model(CalendarEvent::class)
->schema([
Select::make('user_id')
->relationship('user','name'),
Select::make('user_role')
->enum(EventUserRole::class)
->options(EventUserRole::class),
DateTimePicker::make('remind_at')
->seconds(false),
])
Repeater::make('userEvents')
->relationship()
->model(CalendarEvent::class)
->schema([
Select::make('user_id')
->relationship('user','name'),
Select::make('user_role')
->enum(EventUserRole::class)
->options(EventUserRole::class),
DateTimePicker::make('remind_at')
->seconds(false),
])
using the pivot model UserEvent:
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function calendarEvent(): BelongsTo
{
return $this->belongsTo(CalendarEvent::class);
}
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function calendarEvent(): BelongsTo
{
return $this->belongsTo(CalendarEvent::class);
}
One thing I've noticed is that in the edit page, Repeater.php:1095 will run this query:
SELECT * FROM `user_events` WHERE `user_events`.`calendar_event_id` IS NULL and `user_events`.`calendar_event_id` IS not NULL
SELECT * FROM `user_events` WHERE `user_events`.`calendar_event_id` IS NULL and `user_events`.`calendar_event_id` IS not NULL
9 replies
FFilament
Created by ZeroCharistmas on 6/12/2024 in #❓┊help
Text input with partially obfuscated data.
I have a few fields that I need to partially obfuscate in the edit page of my resource. When the input hasn't been changed, I'd like it to not replace the original value with the obfuscated version after save. I've tried using formatStateUsing to replace the value with null or with the obfuscated version, but that changes the original value on save. I can set the placeholder to the obfuscated value, but I still need a way to have the field empty when it's not been changed so the placeholder shows the obfuscated value, still without overwriting when not specifically changed. Also I will love you forever if you can give me a way to clear the input when the user starts typing in the field.
34 replies
FFilament
Created by ZeroCharistmas on 9/13/2023 in #❓┊help
Dynamically creating chart widgets, or creating a custom multi-chart widget?
I'm working on a project that requires multiple custom charts to be displayed on the admin page. Is there a way to render a chart widget for every member of a collection, or am I going to have to create a custom multi-chart widget?
7 replies