Skip to content

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
Show file tree
Hide file tree
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 Nov 7, 2024
49de625
feat :[LAR-30] Remove username in table and add feature test
cybersoldattech Nov 7, 2024
7310074
feat :[LAR-30] Apply lint and remove blank line
cybersoldattech Nov 7, 2024
f858d12
feat: (LAR-20) add xp to dashboard user (#202)
StevyMarlino Nov 8, 2024
91a1d58
chore(deps): bump spatie/laravel-permission from 5.11.1 to 6.10.0 (#199)
dependabot[bot] Nov 8, 2024
076b8f9
chore(deps-dev): bump laravel-vite-plugin from 0.7.8 to 1.0.5 (#194)
dependabot[bot] Nov 8, 2024
c2211e6
chore(deps-dev): bump postcss-loader from 6.2.1 to 8.1.1 (#195)
dependabot[bot] Nov 8, 2024
3459147
chore(deps-dev): bump @ryangjchandler/alpine-tooltip from 1.3.1 to 2.…
dependabot[bot] Nov 8, 2024
da2cf77
feat: (LAR-107) modification du formulaire de register (#206)
Stephen2304 Nov 8, 2024
439de83
feat:[LAR-33] Add filament channel crud in cpanel with feature test (…
cybersoldattech Nov 8, 2024
ade7137
chore(deps): bump symfony/mailgun-mailer from 6.4.13 to 7.1.6 (#198)
dependabot[bot] Nov 8, 2024
e642e11
chore(deps): bump actions/checkout from 3 to 4 (#190)
dependabot[bot] Nov 8, 2024
98d72a6
fix: (LAR-21) resolve sharing article into twitter (#208)
StevyMarlino Nov 9, 2024
b18bdbe
chore(deps): bump the php-dependencies group across 1 directory with …
dependabot[bot] Nov 9, 2024
a328551
chore(deps-dev): bump prettier-plugin-tailwindcss
dependabot[bot] Nov 8, 2024
ed3eed6
feat: [LAR-30] remove blank line and update userTest
cybersoldattech Nov 9, 2024
184bb1b
feat:[LAR-34] Add filament tags crud in cpanel with feature test
cybersoldattech Nov 8, 2024
dc8d4bd
feat: [LAR-34] Remove blank space , add slive over and delete create …
cybersoldattech Nov 8, 2024
b595911
feat: [LAR-34] add unique condition to input name with message and re…
cybersoldattech Nov 8, 2024
f44f72d
chore :[LAR-34] remove space in TestFIle
cybersoldattech Nov 9, 2024
d627d34
chore(deps): bump stevebauman/location from 6.6.2 to 7.4.0 (#197)
dependabot[bot] Nov 9, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,8 @@ SENTRY_LARAVEL_DSN=
SENTRY_TRACES_SAMPLE_RATE=

NOTCHPAY_PUBLIC_KEY=

TWITTER_CONSUMER_KEY=your-consumer-key
TWITTER_CONSUMER_SECRET=your-consumer-secret
TWITTER_ACCESS_TOKEN=your-accesss_token
TWITTER_ACCESS_SECRET=your-access-token-secret
6 changes: 3 additions & 3 deletions .github/workflows/quality.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: 👀 Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: 🪄 Setup
uses: ./.github/actions/setup
- name: 🔮 Install Composer Dependencies
Expand All @@ -28,7 +28,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: 👀 Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: 🪄 Setup
uses: ./.github/actions/setup
- name: 🔮 Install Composer Dependencies
Expand All @@ -40,7 +40,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: 👀 Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: 🪄 Setup
uses: ./.github/actions/setup
- name: 🕵️‍♂️ Run Composer Validate
Expand Down
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
npm-debug.log
yarn-error.log
yarn.lock

/vendor
composer.phar

Expand Down
12 changes: 5 additions & 7 deletions app/Console/Commands/PostArticleToTwitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ final class PostArticleToTwitter extends Command

public function handle(AnonymousNotifiable $notifiable): void
{
if (app()->environment('production')) {
if ($article = Article::nextForSharing()) {
$notifiable->notify(new PostArticleToTwitterNotification($article));

$article->markAsShared();
}
if ($article = Article::nextForSharing()) {
$notifiable->notify(new PostArticleToTwitterNotification($article));

$article->markAsShared();
}
}
}
}
104 changes: 104 additions & 0 deletions app/Filament/Resources/ChannelResource.php
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 app/Filament/Resources/ChannelResource/Pages/ListChannels.php
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),
];
}
}
92 changes: 92 additions & 0 deletions app/Filament/Resources/TagResource.php
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('/'),
];
}
}
24 changes: 24 additions & 0 deletions app/Filament/Resources/TagResource/Pages/ListTags.php
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),
];
}
}
62 changes: 62 additions & 0 deletions app/Filament/Resources/UserResource.php
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']);

Check failure on line 26 in app/Filament/Resources/UserResource.php

View workflow job for this annotation

GitHub Actions / phpstan

Call to an undefined method Illuminate\Database\Eloquent\Builder::withoutRole().
})
->columns([
TextColumn::make('name')
->label('Nom'),
TextColumn::make('email')
->label('Email'),
TextColumn::make(name: 'Points')
->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('/'),
];
}
}
13 changes: 13 additions & 0 deletions app/Filament/Resources/UserResource/Pages/ListUsers.php
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;
}
Loading
Loading