From a8041fc0159db02f6da6b886c5fbcb96cf715769 Mon Sep 17 00:00:00 2001 From: Abhishek Sharma <143715324+abhi-conceptlz@users.noreply.github.com> Date: Fri, 14 Nov 2025 22:39:34 +0530 Subject: [PATCH 1/2] Add Threads resource in filament admin --- .../Resources/Threads/Pages/ListThreads.php | 12 +++ .../Resources/Threads/Tables/ThreadsTable.php | 101 ++++++++++++++++++ .../Resources/Threads/ThreadResource.php | 43 ++++++++ 3 files changed, 156 insertions(+) create mode 100644 app/Filament/Resources/Threads/Pages/ListThreads.php create mode 100644 app/Filament/Resources/Threads/Tables/ThreadsTable.php create mode 100644 app/Filament/Resources/Threads/ThreadResource.php diff --git a/app/Filament/Resources/Threads/Pages/ListThreads.php b/app/Filament/Resources/Threads/Pages/ListThreads.php new file mode 100644 index 000000000..ff26f2f93 --- /dev/null +++ b/app/Filament/Resources/Threads/Pages/ListThreads.php @@ -0,0 +1,12 @@ +columns([ + ImageColumn::make('authorRelation.github_id') + ->label('Author') + ->circular() + ->defaultImageUrl(fn(?string $state): string => $state ? sprintf('https://avatars.githubusercontent.com/u/%s', $state) : asset('images/laravelio-icon-gray.svg')), + + TextColumn::make('authorRelation.name') + ->label('') + ->description(fn(Thread $thread): ?string => $thread->authorRelation->username) + ->searchable(), + + TextColumn::make('subject') + ->searchable(), + + TextColumn::make('solutionReplyRelation.body') + ->label('Solution') + ->limit(300) + ->wrap() + ->searchable(), + + + ImageColumn::make('resolvedByRelation.github_id') + ->label('Resolved by') + ->circular() + ->defaultImageUrl(fn(?string $state): string => $state ? sprintf('https://avatars.githubusercontent.com/u/%s', $state) : asset('images/laravelio-icon-gray.svg')), + + TextColumn::make('resolvedByRelation.name') + ->label('') + ->sortable() + ->searchable(), + + + ImageColumn::make('updatedByRelation.github_id') + ->label('Updated by') + ->circular() + ->defaultImageUrl(fn(?string $state): string => $state ? sprintf('https://avatars.githubusercontent.com/u/%s', $state) : asset('images/laravelio-icon-gray.svg')), + + TextColumn::make('updatedByRelation.name') + ->label('') + ->sortable() + ->searchable(), + + ImageColumn::make('lockedByRelation.github_id') + ->label('Locked by') + ->circular() + ->defaultImageUrl(fn(?string $state): string => $state ? sprintf('https://avatars.githubusercontent.com/u/%s', $state) : asset('images/laravelio-icon-gray.svg')), + + TextColumn::make('lockedByRelation.name') + ->label('') + ->sortable() + ->searchable(), + + TextColumn::make('last_activity_at') + ->dateTime() + ->sortable(), + + TextColumn::make('locked_at') + ->dateTime() + ->sortable(), + + TextColumn::make('created_at') + ->dateTime() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + + TextColumn::make('updated_at') + ->dateTime() + ->sortable() + ->toggleable(isToggledHiddenByDefault: true), + ]) + ->recordActions([ + Action::make('view') + ->url(fn(Thread $thread): string => route('thread', $thread->slug())) + ->openUrlInNewTab() + ->icon('heroicon-s-eye'), + + ]) + ->toolbarActions([ + BulkActionGroup::make([ + DeleteBulkAction::make(), + ]), + ]); + } +} diff --git a/app/Filament/Resources/Threads/ThreadResource.php b/app/Filament/Resources/Threads/ThreadResource.php new file mode 100644 index 000000000..bdb58ee3e --- /dev/null +++ b/app/Filament/Resources/Threads/ThreadResource.php @@ -0,0 +1,43 @@ + ListThreads::route('/'), + ]; + } +} From 079b25a04b54dbbfe21bfcc22be0ae91bdf078c3 Mon Sep 17 00:00:00 2001 From: Dries Vints Date: Mon, 17 Nov 2025 06:19:58 +0100 Subject: [PATCH 2/2] wip --- .../Resources/Threads/Tables/ThreadsTable.php | 38 ------------------- 1 file changed, 38 deletions(-) diff --git a/app/Filament/Resources/Threads/Tables/ThreadsTable.php b/app/Filament/Resources/Threads/Tables/ThreadsTable.php index 07cc5e755..b13bc0cd3 100644 --- a/app/Filament/Resources/Threads/Tables/ThreadsTable.php +++ b/app/Filament/Resources/Threads/Tables/ThreadsTable.php @@ -29,44 +29,6 @@ public static function configure(Table $table): Table TextColumn::make('subject') ->searchable(), - TextColumn::make('solutionReplyRelation.body') - ->label('Solution') - ->limit(300) - ->wrap() - ->searchable(), - - - ImageColumn::make('resolvedByRelation.github_id') - ->label('Resolved by') - ->circular() - ->defaultImageUrl(fn(?string $state): string => $state ? sprintf('https://avatars.githubusercontent.com/u/%s', $state) : asset('images/laravelio-icon-gray.svg')), - - TextColumn::make('resolvedByRelation.name') - ->label('') - ->sortable() - ->searchable(), - - - ImageColumn::make('updatedByRelation.github_id') - ->label('Updated by') - ->circular() - ->defaultImageUrl(fn(?string $state): string => $state ? sprintf('https://avatars.githubusercontent.com/u/%s', $state) : asset('images/laravelio-icon-gray.svg')), - - TextColumn::make('updatedByRelation.name') - ->label('') - ->sortable() - ->searchable(), - - ImageColumn::make('lockedByRelation.github_id') - ->label('Locked by') - ->circular() - ->defaultImageUrl(fn(?string $state): string => $state ? sprintf('https://avatars.githubusercontent.com/u/%s', $state) : asset('images/laravelio-icon-gray.svg')), - - TextColumn::make('lockedByRelation.name') - ->label('') - ->sortable() - ->searchable(), - TextColumn::make('last_activity_at') ->dateTime() ->sortable(),