Filament moderne (groupes nav, 4 charts, filtres/badges) + Filament Shield (rôles/permissions) + noms exos localisés dans routines
Build & Deploy / build (push) Successful in 19s
Build & Deploy / build (push) Successful in 19s
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -2,10 +2,8 @@
|
||||
|
||||
namespace App\Filament\Resources\Achievements;
|
||||
|
||||
use App\Filament\Resources\Achievements\Pages\CreateAchievement;
|
||||
use App\Filament\Resources\Achievements\Pages\EditAchievement;
|
||||
use App\Filament\Resources\Achievements\Pages\ListAchievements;
|
||||
use App\Filament\Resources\Achievements\Schemas\AchievementForm;
|
||||
use App\Filament\Resources\Achievements\Schemas\AchievementInfolist;
|
||||
use App\Filament\Resources\Achievements\Tables\AchievementsTable;
|
||||
use BackedEnum;
|
||||
use Filament\Resources\Resource;
|
||||
@@ -13,16 +11,32 @@ use Filament\Schemas\Schema;
|
||||
use Filament\Support\Icons\Heroicon;
|
||||
use Filament\Tables\Table;
|
||||
use Functional\Streaks\Models\Achievement;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use UnitEnum;
|
||||
|
||||
/**
|
||||
* Badges débloqués par StreakService aux paliers de streak — consultation + suppression
|
||||
* uniquement, jamais de création/édition manuelle depuis le back-office.
|
||||
*/
|
||||
class AchievementResource extends Resource
|
||||
{
|
||||
protected static ?string $model = Achievement::class;
|
||||
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedRectangleStack;
|
||||
protected static string|BackedEnum|null $navigationIcon = Heroicon::OutlinedTrophy;
|
||||
|
||||
public static function form(Schema $schema): Schema
|
||||
protected static string|UnitEnum|null $navigationGroup = 'Gamification';
|
||||
|
||||
protected static ?int $navigationSort = 2;
|
||||
|
||||
protected static ?string $modelLabel = 'badge';
|
||||
|
||||
protected static ?string $pluralModelLabel = 'badges';
|
||||
|
||||
protected static ?string $recordTitleAttribute = 'key';
|
||||
|
||||
public static function infolist(Schema $schema): Schema
|
||||
{
|
||||
return AchievementForm::configure($schema);
|
||||
return AchievementInfolist::configure($schema);
|
||||
}
|
||||
|
||||
public static function table(Table $table): Table
|
||||
@@ -30,19 +44,28 @@ class AchievementResource extends Resource
|
||||
return AchievementsTable::configure($table);
|
||||
}
|
||||
|
||||
public static function getRelations(): array
|
||||
public static function canCreate(): bool
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
return false;
|
||||
}
|
||||
|
||||
public static function canEdit(Model $record): bool
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array<int, string>
|
||||
*/
|
||||
public static function getGloballySearchableAttributes(): array
|
||||
{
|
||||
return ['key', 'user.name'];
|
||||
}
|
||||
|
||||
public static function getPages(): array
|
||||
{
|
||||
return [
|
||||
'index' => ListAchievements::route('/'),
|
||||
'create' => CreateAchievement::route('/create'),
|
||||
'edit' => EditAchievement::route('/{record}/edit'),
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user