49 lines
1.6 KiB
PHP
49 lines
1.6 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Resources\Projects;
|
|
|
|
use App\Filament\Resources\Projects\Pages;
|
|
use App\Models\Project;
|
|
use Filament\Schemas\Schema;
|
|
use Filament\Resources\Resource;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Table;
|
|
use App\Enums\NavigationGroup;
|
|
use App\Filament\Resources\Projects\Schemas\ProjectForm;
|
|
|
|
class ProjectResource extends Resource
|
|
{
|
|
protected static array $permissionActions = ["view", "create", "update", "delete", "restore", "forceDelete"];
|
|
protected static ?string $model = Project::class;
|
|
protected static string | \BackedEnum | null $navigationIcon = 'heroicon-o-building-office-2';
|
|
protected static string | \UnitEnum | null $navigationGroup = NavigationGroup::PROJECT->value;
|
|
protected static ?int $navigationSort = 1;
|
|
|
|
protected static ?string $modelLabel = 'Dự án';
|
|
protected static ?string $pluralModelLabel = 'Dự án';
|
|
|
|
public static function form(Schema $schema): Schema
|
|
{
|
|
return ProjectForm::configure($schema);
|
|
}
|
|
|
|
public static function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->columns([
|
|
Tables\Columns\TextColumn::make('code')->label('Mã')->sortable(),
|
|
Tables\Columns\TextColumn::make('name')->label('Tên Dự án')->searchable(),
|
|
Tables\Columns\TextColumn::make('type')->label('Loại hình')->badge(),
|
|
]);
|
|
}
|
|
|
|
public static function getPages(): array
|
|
{
|
|
return [
|
|
'index' => Pages\ListProjects::route('/'),
|
|
'create' => Pages\CreateProject::route('/create'),
|
|
'edit' => Pages\EditProject::route('/{record}/edit'),
|
|
];
|
|
}
|
|
}
|