76 lines
2.3 KiB
PHP
76 lines
2.3 KiB
PHP
<?php
|
|
|
|
namespace App\Filament\Pages;
|
|
|
|
use Filament\Pages\Page;
|
|
use Filament\Tables;
|
|
use Filament\Tables\Table;
|
|
use Illuminate\Database\Eloquent\Builder;
|
|
use Filament\Forms\Contracts\HasForms;
|
|
use Filament\Forms\Concerns\InteractsWithForms;
|
|
use App\Models\Plugin;
|
|
|
|
class Plugins extends Page implements Tables\Contracts\HasTable, HasForms
|
|
{
|
|
use Tables\Concerns\InteractsWithTable;
|
|
use InteractsWithForms;
|
|
|
|
protected static ?string $navigationIcon = 'heroicon-o-puzzle-piece';
|
|
|
|
protected static ?string $navigationGroup = 'Plugins';
|
|
|
|
protected static ?string $navigationLabel = 'Plugin List';
|
|
|
|
protected static ?string $title = 'Plugins';
|
|
|
|
protected static string $view = 'filament.pages.plugins';
|
|
|
|
protected static ?string $slug = 'list-plugins';
|
|
|
|
public function table(Table $table): Table
|
|
{
|
|
return $table
|
|
->query(Plugin::query()) // Use a dummy query
|
|
->columns([
|
|
Tables\Columns\TextColumn::make('name')
|
|
->label('Name')
|
|
->searchable()
|
|
->sortable(),
|
|
Tables\Columns\TextColumn::make('identifier')
|
|
->label('Identifier'),
|
|
Tables\Columns\IconColumn::make('enabled')
|
|
->label('Enabled')
|
|
->boolean(),
|
|
Tables\Columns\IconColumn::make('configured')
|
|
->label('Configured')
|
|
->boolean()
|
|
->tooltip(fn ($record) => $record->configured ? 'Has ApiProvider record' : 'No ApiProvider record'),
|
|
Tables\Columns\TextColumn::make('file_path')
|
|
->label('File Path')
|
|
->toggleable(isToggledHiddenByDefault: true),
|
|
]);
|
|
}
|
|
|
|
public $plugins;
|
|
|
|
public function mount(): void
|
|
{
|
|
$this->plugins = Plugin::getAllPlugins();
|
|
}
|
|
|
|
public static function getNavigationGroup(): ?string
|
|
{
|
|
return __('filament.navigation.groups.plugins');
|
|
}
|
|
|
|
public static function getNavigationLabel(): string
|
|
{
|
|
return __('filament.navigation.plugin_list');
|
|
}
|
|
|
|
public function currentlyValidatingForm(\Filament\Forms\ComponentContainer|null $form): void
|
|
{
|
|
// No form validation needed for this page
|
|
}
|
|
}
|