Files
larablog/app/Filament/Pages/PluginSkeletonPage.php
T
ak 263b98b218 Initial baseline: LaraBlog core with plugin commerce surface.
Captures the current working tree after theme slots, ArticleAccess, and the payment / paid-content plugins so subsequent work has a reviewable git history.
2026-08-12 01:15:38 +08:00

76 lines
1.8 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Filament\Pages;
use App\Models\Plugin;
use BackedEnum;
use Filament\Pages\Page;
abstract class PluginSkeletonPage extends Page
{
protected static ?int $navigationSort = 100;
protected string $view = 'filament.pages.plugin-skeleton';
abstract protected static function pluginName(): string;
abstract protected static function navKey(): string;
public static function getNavigationGroup(): ?string
{
return __('admin.groups.plugins');
}
public static function getNavigationLabel(): string
{
return __('admin.nav.'.static::navKey());
}
public function getTitle(): string
{
return static::translatedTitle();
}
public function getHeading(): string
{
return static::translatedTitle();
}
protected static function translatedTitle(): string
{
$key = 'admin.plugins.'.static::pluginName().'.title';
return __($key) !== $key ? __($key) : __('admin.nav.'.static::navKey());
}
protected static function translatedDescription(): string
{
$key = 'admin.plugins.'.static::pluginName().'.description';
return __($key) !== $key ? __($key) : '';
}
public static function shouldRegisterNavigation(): bool
{
return Plugin::query()
->where('name', static::pluginName())
->where('enabled', true)
->exists();
}
public function getViewData(): array
{
return [
'pluginName' => static::pluginName(),
'pluginTitle' => static::translatedTitle(),
'pluginDescription' => static::translatedDescription(),
'enabled' => Plugin::query()
->where('name', static::pluginName())
->where('enabled', true)
->exists(),
];
}
}