Files
laraundfelix/app/Filament/Resources/LicenseArticles/LicenseArticleResource.php
T
LarsandCursor fd6860efda
Deploy Test / test (push) Successful in 12s
Deploy Test / deploy (push) Successful in 21s
Öffne Katalog, Bibliothek und Testkauf für den MVP.
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-15 09:04:08 +01:00

62 lines
1.6 KiB
PHP

<?php
namespace App\Filament\Resources\LicenseArticles;
use App\Domain\Catalog\LicenseArticle;
use App\Domain\Identity\StaffRole;
use App\Filament\Resources\LicenseArticles\Pages\ListLicenseArticles;
use App\Models\User;
use Filament\Facades\Filament;
use Filament\Resources\Resource;
use Filament\Schemas\Schema;
use Filament\Tables\Columns\TextColumn;
use Filament\Tables\Table;
class LicenseArticleResource extends Resource
{
protected static ?string $model = LicenseArticle::class;
protected static string|\UnitEnum|null $navigationGroup = 'Katalog';
protected static ?string $navigationLabel = 'Lizenzartikel';
protected static ?string $modelLabel = 'Lizenzartikel';
protected static ?string $pluralModelLabel = 'Lizenzartikel';
protected static ?string $recordTitleAttribute = 'code';
public static function canViewAny(): bool
{
return self::keeper();
}
public static function keeper(): bool
{
$user = Filament::auth()->user();
return $user instanceof User && $user->hasStaffRole(StaffRole::Katalogverwalter);
}
public static function form(Schema $schema): Schema
{
return $schema;
}
public static function table(Table $table): Table
{
return $table->columns([
TextColumn::make('code')->label('Kennung')->searchable(),
TextColumn::make('product_line')->label('Produktlinie'),
TextColumn::make('currentRelease.number')->label('Aktueller Stand'),
])->recordUrl(null);
}
public static function getPages(): array
{
return [
'index' => ListLicenseArticles::route('/'),
];
}
}