mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 06:24:44 +02:00
34 lines
816 B
PHP
34 lines
816 B
PHP
<?php
|
|
|
|
namespace App\Filament\Admin\Widgets;
|
|
|
|
use App\Filament\Admin\Resources\NodeResource\Pages\CreateNode;
|
|
use App\Models\Node;
|
|
use Filament\Actions\Action;
|
|
use Filament\Widgets\Widget;
|
|
|
|
class NoNodesWidget extends Widget
|
|
{
|
|
protected string $view = 'filament.admin.widgets.no-nodes-widget';
|
|
|
|
protected static bool $isLazy = false;
|
|
|
|
protected static ?int $sort = 2;
|
|
|
|
public static function canView(): bool
|
|
{
|
|
return Node::count() <= 0;
|
|
}
|
|
|
|
public function getViewData(): array
|
|
{
|
|
return [
|
|
'action' => Action::make('create-node')
|
|
->label(trans('admin/dashboard.sections.intro-first-node.button_label'))
|
|
->icon('tabler-server-2')
|
|
->url(CreateNode::getUrl())
|
|
->toHtmlString(),
|
|
];
|
|
}
|
|
}
|