enshtein
enshtein
FFilament
Created by enshtein on 3/21/2023 in #❓┊help
Nested records in a table
10 replies
FFilament
Created by enshtein on 3/21/2023 in #❓┊help
Nested records in a table
Thanks, now I'll post the trick on filamentphp.com )
10 replies
FFilament
Created by enshtein on 3/21/2023 in #❓┊help
Nested records in a table
10 replies
FFilament
Created by enshtein on 3/21/2023 in #❓┊help
Nested records in a table
and its usage: return $table ->columns([ Tables\Columns\TextColumn::make('id'), Tables\Columns\TextColumn::make('parent_id'), Tables\Columns\TextColumn::make('name') ->getStateUsing(function(FileDocumentCat $record) { return self::getNestedPrefix($record->id) . ($record->parent_id ? '-- ' : '') . $record->name; }) ->html(),
10 replies
FFilament
Created by enshtein on 3/21/2023 in #❓┊help
Nested records in a table
No problem, just one method: private static function getNestedPrefix($parent_id, $prefix='    '): string { static $parents = null; if ($parents==null) $parents = self::$model::all()->pluck('parent_id', 'id'); if ($parent_id==0) return ''; if (isset($parents[$parent_id]) && $parents[$parent_id]) $prefix .= self::getNestedPrefix($parents[$parent_id], $prefix); return $prefix; }
10 replies
FFilament
Created by enshtein on 3/21/2023 in #❓┊help
Default selection for radio element - not working!
This is a form for setting up an action in a modal window for records from a table
8 replies
FFilament
Created by enshtein on 3/21/2023 in #❓┊help
Default selection for radio element - not working!
BulkAction::make('send_mail') ->label('Send mail') ->color('primary') ->icon('heroicon-o-mail') ->action(function (Collection $records, array $data): void { self::actionSendEmails($data); }) ->steps(self::wizardSendEmails()), public static function wizardSendEmails() { return [ Forms\Components\Wizard\Step::make('Receivers') ->schema([
8 replies
FFilament
Created by enshtein on 3/21/2023 in #❓┊help
Default selection for radio element - not working!
this is from a form in a modal window action
8 replies