peteswan23
peteswan23
FFilament
Created by peteswan23 on 3/7/2025 in #❓┊help
Multiple Relationships
Hi guys, is this relationship possible? I'm in my ProjectTask model, and want add sub tasks which are a few relationships down (via tasks) Forms\Components\Repeater::make('tasks.subtasks') ->relationship('task.subtasks') ->schema([ Forms\Components\TextInput::make('name')->required(), Forms\Components\Checkbox::make('is_done')->label('Completed'),
3 replies
FFilament
Created by peteswan23 on 3/5/2025 in #❓┊help
format minutes as hours in form, and save back to database as minutes.
Hi guys, - im not sure what im doing wrong. I store planned_time in minutes in the db. I want the filament form to show in hours, and save back to the db in minutes. Here is my current code. I can either get it to save, or to show on the form properly, but not both. what am I doing wrong? Forms\Components\TextInput::make('planned_time_input') ->label('Planned Time (Hours)') ->numeric() ->minValue(0.25) ->step(0.25) ->helperText('Enter time in hours (e.g., 1.5 for 90 minutes)') ->displayUsing(fn ($value) => number_format($value / 60, 2)) ->afterStateUpdated(fn ($state, Forms\Set $set) => $set('planned_time', $state * 60) ), Forms\Components\Hidden::make('planned_time'),
5 replies