mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-11-04 02:36:53 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			35 lines
		
	
	
		
			835 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			835 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace App\Filament\Admin\Widgets;
 | 
						|
 | 
						|
use App\Filament\Admin\Resources\NodeResource\Pages\CreateNode;
 | 
						|
use App\Models\Node;
 | 
						|
use Filament\Actions\CreateAction;
 | 
						|
use Filament\Widgets\Widget;
 | 
						|
 | 
						|
class NoNodesWidget extends Widget
 | 
						|
{
 | 
						|
    protected static 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 [
 | 
						|
            'actions' => [
 | 
						|
                CreateAction::make()
 | 
						|
                    ->label(trans('admin/dashboard.sections.intro-first-node.button_label'))
 | 
						|
                    ->icon('tabler-server-2')
 | 
						|
                    ->url(CreateNode::getUrl()),
 | 
						|
            ],
 | 
						|
        ];
 | 
						|
    }
 | 
						|
}
 |