Skip to content

feat:[LAR-34] Add filament tags crud in cpanel with feature test #203

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
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
4453f98
feat:[LAR-34] Add filament tags crud in cpanel with feature test
cybersoldattech Nov 8, 2024
ead8285
feat: (LAR-20) add xp to dashboard user (#202)
StevyMarlino Nov 8, 2024
43ce8d2
chore(deps): bump spatie/laravel-permission from 5.11.1 to 6.10.0 (#199)
dependabot[bot] Nov 8, 2024
9abcbe4
chore(deps-dev): bump laravel-vite-plugin from 0.7.8 to 1.0.5 (#194)
dependabot[bot] Nov 8, 2024
c11e019
chore(deps-dev): bump postcss-loader from 6.2.1 to 8.1.1 (#195)
dependabot[bot] Nov 8, 2024
7f02596
chore(deps-dev): bump @ryangjchandler/alpine-tooltip from 1.3.1 to 2.…
dependabot[bot] Nov 8, 2024
3950138
feat: (LAR-107) modification du formulaire de register (#206)
Stephen2304 Nov 8, 2024
73892a7
feat:[LAR-33] Add filament channel crud in cpanel with feature test (…
cybersoldattech Nov 8, 2024
2891914
chore(deps): bump symfony/mailgun-mailer from 6.4.13 to 7.1.6 (#198)
dependabot[bot] Nov 8, 2024
d993ba8
feat: [LAR-34] Remove blank space , add slive over and delete create …
cybersoldattech Nov 8, 2024
eddb78a
feat: [LAR-34] add unique condition to input name with message and re…
cybersoldattech Nov 8, 2024
f990652
chore :[LAR-34] remove space in TestFIle
cybersoldattech Nov 9, 2024
94b9b48
chore(deps): bump actions/checkout from 3 to 4 (#190)
dependabot[bot] Nov 8, 2024
edf0449
fix: (LAR-21) resolve sharing article into twitter (#208)
StevyMarlino Nov 9, 2024
89ac0e6
chore(deps): bump the php-dependencies group across 1 directory with …
dependabot[bot] Nov 9, 2024
d76617d
chore(deps-dev): bump prettier-plugin-tailwindcss
dependabot[bot] Nov 8, 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
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
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),
];
}
}
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,12 @@
"spatie/laravel-feed": "^4.2.1",
"spatie/laravel-google-fonts": "^1.2.3",
"spatie/laravel-medialibrary": "^10.10.0",
"spatie/laravel-permission": "^5.10.1",
"spatie/laravel-permission": "^6.10.0",
"spatie/laravel-sitemap": "^7.2.1",
"spatie/laravel-translatable": "^6.8",
"stevebauman/location": "^6.6.2",
"symfony/http-client": "^6.3.1",
"symfony/mailgun-mailer": "^6.3",
"symfony/mailgun-mailer": "^7.1",
"torchlight/torchlight-commonmark": "^0.5.5",
"wire-elements/modal": "^2.0",
"wire-elements/spotlight": "^2.0",
Expand Down
Loading
Loading