-
-
Notifications
You must be signed in to change notification settings - Fork 15
feat: [LAR-30] Add filament resource user in cpanel #201
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 21 commits into
develop
from
feature/lar-30-admin-filament-mettre-en-place-le-listing-des-utilisateurs
Nov 9, 2024
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
d95248a
feat: [LAR-30] Add filament resource user in cpanel
cybersoldattech 49de625
feat :[LAR-30] Remove username in table and add feature test
cybersoldattech 7310074
feat :[LAR-30] Apply lint and remove blank line
cybersoldattech f858d12
feat: (LAR-20) add xp to dashboard user (#202)
StevyMarlino 91a1d58
chore(deps): bump spatie/laravel-permission from 5.11.1 to 6.10.0 (#199)
dependabot[bot] 076b8f9
chore(deps-dev): bump laravel-vite-plugin from 0.7.8 to 1.0.5 (#194)
dependabot[bot] c2211e6
chore(deps-dev): bump postcss-loader from 6.2.1 to 8.1.1 (#195)
dependabot[bot] 3459147
chore(deps-dev): bump @ryangjchandler/alpine-tooltip from 1.3.1 to 2.…
dependabot[bot] da2cf77
feat: (LAR-107) modification du formulaire de register (#206)
Stephen2304 439de83
feat:[LAR-33] Add filament channel crud in cpanel with feature test (…
cybersoldattech ade7137
chore(deps): bump symfony/mailgun-mailer from 6.4.13 to 7.1.6 (#198)
dependabot[bot] e642e11
chore(deps): bump actions/checkout from 3 to 4 (#190)
dependabot[bot] 98d72a6
fix: (LAR-21) resolve sharing article into twitter (#208)
StevyMarlino b18bdbe
chore(deps): bump the php-dependencies group across 1 directory with …
dependabot[bot] a328551
chore(deps-dev): bump prettier-plugin-tailwindcss
dependabot[bot] ed3eed6
feat: [LAR-30] remove blank line and update userTest
cybersoldattech 184bb1b
feat:[LAR-34] Add filament tags crud in cpanel with feature test
cybersoldattech dc8d4bd
feat: [LAR-34] Remove blank space , add slive over and delete create …
cybersoldattech b595911
feat: [LAR-34] add unique condition to input name with message and re…
cybersoldattech f44f72d
chore :[LAR-34] remove space in TestFIle
cybersoldattech d627d34
chore(deps): bump stevebauman/location from 6.6.2 to 7.4.0 (#197)
dependabot[bot] 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
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
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 |
---|---|---|
|
@@ -4,7 +4,6 @@ | |
npm-debug.log | ||
yarn-error.log | ||
yarn.lock | ||
|
||
/vendor | ||
composer.phar | ||
|
||
|
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
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,104 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources; | ||
|
||
use App\Filament\Resources\ChannelResource\Pages; | ||
use App\Models\Channel; | ||
use Filament\Forms; | ||
use Filament\Forms\Form; | ||
use Filament\Resources\Resource; | ||
use Filament\Support\Enums\MaxWidth; | ||
use Filament\Tables; | ||
use Filament\Tables\Actions\ActionGroup; | ||
use Filament\Tables\Table; | ||
use Illuminate\Database\Eloquent\Builder; | ||
use Illuminate\Support\Str; | ||
|
||
final class ChannelResource extends Resource | ||
{ | ||
protected static ?string $model = Channel::class; | ||
|
||
protected static ?string $navigationIcon = 'heroicon-o-queue-list'; | ||
|
||
public static function getLabel(): string | ||
{ | ||
return __('Channels'); | ||
} | ||
|
||
public static function form(Form $form): Form | ||
{ | ||
return $form | ||
->schema([ | ||
Forms\Components\Section::make() | ||
->schema([ | ||
Forms\Components\TextInput::make('name') | ||
->required() | ||
->live(onBlur: true) | ||
->afterStateUpdated(function (string $operation, $state, Forms\Set $set): void { | ||
$set('slug', Str::slug($state)); | ||
}), | ||
Forms\Components\TextInput::make('slug') | ||
->readOnly() | ||
->helperText(__('Cette valeur est générée dynamiquement en fonction du Name.')), | ||
Forms\Components\Select::make('parent_id') | ||
->relationship('parent', 'name', fn (Builder $query) => $query->whereNull('parent_id')) | ||
->default(null), | ||
Forms\Components\TextInput::make('color') | ||
->maxLength(255) | ||
->type('color'), | ||
Forms\Components\Textarea::make('description.fr') | ||
->label('Description') | ||
->columnSpanFull(), | ||
]) | ||
->columnSpan(['lg' => 2]), | ||
]); | ||
} | ||
|
||
public static function table(Table $table): Table | ||
{ | ||
return $table | ||
->columns([ | ||
Tables\Columns\TextColumn::make('name') | ||
->searchable(), | ||
Tables\Columns\TextColumn::make('slug') | ||
->searchable(), | ||
Tables\Columns\TextColumn::make('parent.name') | ||
->numeric() | ||
->sortable(), | ||
Tables\Columns\TextColumn::make('thread_number') | ||
->label('Nombre de thead') | ||
->getStateUsing(fn ($record) => $record->threads()->count()), | ||
Tables\Columns\TextColumn::make('color') | ||
->searchable(), | ||
Tables\Columns\TextColumn::make('created_at') | ||
->dateTime() | ||
->sortable() | ||
->toggleable(isToggledHiddenByDefault: true), | ||
]) | ||
->filters([ | ||
|
||
]) | ||
->actions([ | ||
ActionGroup::make([ | ||
Tables\Actions\DeleteAction::make(), | ||
Tables\Actions\EditAction::make() | ||
->slideOver() | ||
->modalWidth(MaxWidth::Large), | ||
]), | ||
]) | ||
->bulkActions([ | ||
Tables\Actions\BulkActionGroup::make([ | ||
Tables\Actions\DeleteBulkAction::make(), | ||
]), | ||
]); | ||
} | ||
|
||
public static function getPages(): array | ||
{ | ||
return [ | ||
'index' => Pages\ListChannels::route('/'), | ||
]; | ||
} | ||
} |
24 changes: 24 additions & 0 deletions
24
app/Filament/Resources/ChannelResource/Pages/ListChannels.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,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources\ChannelResource\Pages; | ||
|
||
use App\Filament\Resources\ChannelResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\ListRecords; | ||
use Filament\Support\Enums\MaxWidth; | ||
|
||
final class ListChannels extends ListRecords | ||
{ | ||
protected static string $resource = ChannelResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\CreateAction::make() | ||
->slideOver() | ||
->modalWidth(MaxWidth::Large), | ||
]; | ||
} | ||
} |
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,92 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources; | ||
|
||
use App\Filament\Resources\TagResource\Pages; | ||
use App\Models\Tag; | ||
use Filament\Forms; | ||
use Filament\Forms\Components\Select; | ||
use Filament\Forms\Form; | ||
use Filament\Resources\Resource; | ||
use Filament\Support\Enums\MaxWidth; | ||
use Filament\Tables; | ||
use Filament\Tables\Table; | ||
use Illuminate\Support\Str; | ||
|
||
final class TagResource extends Resource | ||
{ | ||
protected static ?string $model = Tag::class; | ||
|
||
protected static ?string $navigationIcon = 'heroicon-o-tag'; | ||
|
||
public static function form(Form $form): Form | ||
{ | ||
return $form | ||
->schema([ | ||
Forms\Components\TextInput::make('name') | ||
->live(onBlur: true) | ||
->required() | ||
->unique() | ||
->validationMessages([ | ||
'unique' => 'Cette valeur existe déjà', | ||
]) | ||
->afterStateUpdated(function (string $operation, $state, Forms\Set $set): void { | ||
$set('slug', Str::slug($state)); | ||
}) | ||
->columnSpanFull(), | ||
Forms\Components\TextInput::make('slug') | ||
->readOnly() | ||
->required() | ||
->helperText(__('Cette valeur est générée dynamiquement en fonction du Name.')) | ||
->columnSpanFull(), | ||
Select::make('concerns') | ||
->multiple() | ||
->options([ | ||
'post' => 'Post', | ||
'tutorial' => 'Tutoriel', | ||
'discussion' => 'Discussion', | ||
]) | ||
->required() | ||
->columnSpanFull(), | ||
Forms\Components\Textarea::make('description') | ||
->columnSpanFull(), | ||
]); | ||
} | ||
|
||
public static function table(Table $table): Table | ||
{ | ||
return $table | ||
->columns([ | ||
Tables\Columns\TextColumn::make('name') | ||
->searchable(), | ||
Tables\Columns\TextColumn::make('slug') | ||
->searchable(), | ||
Tables\Columns\TextColumn::make(name: 'concerns'), | ||
]) | ||
->filters([ | ||
// | ||
]) | ||
->actions([ | ||
\Filament\Tables\Actions\ActionGroup::make([ | ||
Tables\Actions\DeleteAction::make(), | ||
Tables\Actions\EditAction::make() | ||
->slideOver() | ||
->modalWidth(MaxWidth::Large), | ||
]), | ||
]) | ||
->bulkActions([ | ||
Tables\Actions\BulkActionGroup::make([ | ||
Tables\Actions\DeleteBulkAction::make(), | ||
]), | ||
]); | ||
} | ||
|
||
public static function getPages(): array | ||
{ | ||
return [ | ||
'index' => Pages\ListTags::route('/'), | ||
]; | ||
} | ||
} |
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,24 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources\TagResource\Pages; | ||
|
||
use App\Filament\Resources\TagResource; | ||
use Filament\Actions; | ||
use Filament\Resources\Pages\ListRecords; | ||
use Filament\Support\Enums\MaxWidth; | ||
|
||
final class ListTags extends ListRecords | ||
{ | ||
protected static string $resource = TagResource::class; | ||
|
||
protected function getHeaderActions(): array | ||
{ | ||
return [ | ||
Actions\CreateAction::make() | ||
->slideOver() | ||
->modalWidth(MaxWidth::Large), | ||
]; | ||
} | ||
} |
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,62 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace App\Filament\Resources; | ||
|
||
use App\Filament\Resources\UserResource\Pages; | ||
use App\Models\User; | ||
use Filament\Resources\Resource; | ||
use Filament\Tables; | ||
use Filament\Tables\Actions\ActionGroup; | ||
use Filament\Tables\Columns\TextColumn; | ||
use Filament\Tables\Table; | ||
use Illuminate\Database\Eloquent\Builder; | ||
|
||
final class UserResource extends Resource | ||
{ | ||
protected static ?string $model = User::class; | ||
|
||
protected static ?string $navigationIcon = 'heroicon-o-user'; | ||
|
||
public static function table(Table $table): Table | ||
{ | ||
return $table | ||
->modifyQueryUsing(function (Builder $query): void { | ||
$query->withoutRole(['admin', 'moderator']); | ||
}) | ||
->columns([ | ||
TextColumn::make('name') | ||
->label('Nom'), | ||
TextColumn::make('email') | ||
->label('Email'), | ||
TextColumn::make(name: 'Points') | ||
cybersoldattech marked this conversation as resolved.
Show resolved
Hide resolved
|
||
->getStateUsing(fn (User $user) => $user->getPoints().' XP') | ||
->sortable(), | ||
TextColumn::make(name: 'created_at') | ||
->label('Date de création'), | ||
TextColumn::make(name: 'created_at') | ||
->label('Date de création'), | ||
]) | ||
->filters([ | ||
// | ||
]) | ||
->actions([ | ||
ActionGroup::make([ | ||
Tables\Actions\DeleteAction::make(), | ||
]), | ||
]) | ||
->bulkActions([ | ||
Tables\Actions\BulkActionGroup::make([ | ||
Tables\Actions\DeleteBulkAction::make(), | ||
]), | ||
]); | ||
} | ||
|
||
public static function getPages(): array | ||
{ | ||
return [ | ||
'index' => Pages\ListUsers::route('/'), | ||
]; | ||
} | ||
} |
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\UserResource\Pages; | ||
|
||
use App\Filament\Resources\UserResource; | ||
use Filament\Resources\Pages\ListRecords; | ||
|
||
final class ListUsers extends ListRecords | ||
{ | ||
protected static string $resource = UserResource::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.