-
-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathDeveloperPluginsRelationManager.php
More file actions
49 lines (43 loc) · 1.6 KB
/
DeveloperPluginsRelationManager.php
File metadata and controls
49 lines (43 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
<?php
namespace App\Filament\Resources\UserResource\RelationManagers;
use App\Enums\PluginStatus;
use App\Enums\PluginType;
use App\Filament\Resources\PluginResource;
use Filament\Resources\RelationManagers\RelationManager;
use Filament\Tables;
use Filament\Tables\Table;
class DeveloperPluginsRelationManager extends RelationManager
{
protected static string $relationship = 'plugins';
protected static ?string $title = 'Developer Plugins';
public function isReadOnly(): bool
{
return true;
}
public function table(Table $table): Table
{
return $table
->columns([
Tables\Columns\TextColumn::make('name')
->label('Package')
->searchable()
->sortable()
->fontFamily('mono'),
Tables\Columns\TextColumn::make('type')
->badge()
->color(fn (PluginType $state): string => match ($state) {
PluginType::Free => 'gray',
PluginType::Paid => 'success',
}),
Tables\Columns\TextColumn::make('status')
->badge()
->color(fn (PluginStatus $state): string => $state->color()),
Tables\Columns\TextColumn::make('created_at')
->label('Submitted')
->dateTime()
->sortable(),
])
->defaultSort('created_at', 'desc')
->recordUrl(fn ($record) => PluginResource::getUrl('edit', ['record' => $record]));
}
}