-
-
Notifications
You must be signed in to change notification settings - Fork 15
feat:[LAR-129] Add Filament resource Thread in Admin #244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
cybersoldattech
merged 6 commits into
develop
from
feature/lar-129-ramener-les-threads-sur-la-branche-develop
Dec 13, 2024
Merged
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
d7baa48
feat:[LAR-129] Add Filament resource Thread in Admin
cybersoldattech 75c5e8d
feat:[lar-129] modify icon columns , move author columns...
cybersoldattech 11ac867
feat:[lar-129] Apply lint
cybersoldattech 9678bd8
feat:[Lar-129] change icone to resolver name
cybersoldattech 54f4aa1
feat:[lar-129] change resolver name to thread status
cybersoldattech 95c1a16
feat:lar-129 change text colunm text and badge color
cybersoldattech File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources; | ||
|
||
use App\Filament\Resources\ThreadResource\Pages; | ||
use App\Models\Thread; | ||
use Filament\Resources\Resource; | ||
use Filament\Tables; | ||
use Filament\Tables\Actions\Action; | ||
use Filament\Tables\Actions\ActionGroup; | ||
use Filament\Tables\Columns\IconColumn; | ||
use Filament\Tables\Columns\TextColumn; | ||
use Filament\Tables\Filters\SelectFilter; | ||
use Filament\Tables\Table; | ||
|
||
final class ThreadResource extends Resource | ||
{ | ||
protected static ?string $model = Thread::class; | ||
|
||
protected static ?string $navigationIcon = 'heroicon-o-chat-bubble-left-right'; | ||
|
||
public static function getNavigationGroup(): string | ||
{ | ||
return __('Forum'); | ||
} | ||
|
||
public static function table(Table $table): Table | ||
{ | ||
return $table | ||
->columns([ | ||
TextColumn::make('title') | ||
->label('Titre') | ||
->sortable(), | ||
TextColumn::make('user.name') | ||
->label('Auteur'), | ||
IconColumn::make('locked') | ||
->label('Vérrouillé') | ||
->boolean() | ||
->trueIcon('heroicon-s-lock-closed') | ||
->trueColor('warning') | ||
->falseIcon('heroicon-s-lock-open') | ||
->falseColor('success'), | ||
TextColumn::make('resolved_by') | ||
->badge() | ||
->getStateUsing(fn ($record) => $record->resolved_by == null ? 'Non résolu' : 'Résolu') | ||
->label(fn ($state) => $state) | ||
->color(fn ($record) => ($record?->resolved_by == null) ? 'warning' : 'success'), | ||
cybersoldattech marked this conversation as resolved.
Show resolved
Hide resolved
|
||
TextColumn::make('created_at') | ||
->label('Date de publication') | ||
->dateTime(), | ||
]) | ||
->filters([ | ||
SelectFilter::make('Channels')->relationship('channels', 'name')->searchable()->preload(), | ||
]) | ||
->actions([ | ||
ActionGroup::make([ | ||
Action::make('view') | ||
->label('Voir le thread') | ||
->icon('heroicon-o-eye') | ||
->color('success') | ||
->url(fn (Thread $record): string => route('forum.show', $record)) | ||
->openUrlInNewTab(), | ||
Tables\Actions\DeleteAction::make(), | ||
]), | ||
]) | ||
->bulkActions([ | ||
Tables\Actions\BulkActionGroup::make([ | ||
Tables\Actions\DeleteBulkAction::make(), | ||
]), | ||
]); | ||
} | ||
|
||
public static function getPages(): array | ||
{ | ||
return [ | ||
'index' => Pages\ListThreads::route('/'), | ||
]; | ||
} | ||
} |
13 changes: 13 additions & 0 deletions
13
app/Filament/Resources/ThreadResource/Pages/ListThreads.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources\ThreadResource\Pages; | ||
|
||
use App\Filament\Resources\ThreadResource; | ||
use Filament\Resources\Pages\ListRecords; | ||
|
||
final class ListThreads extends ListRecords | ||
{ | ||
protected static string $resource = ThreadResource::class; | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.