mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-31 18:16:55 +01:00 
			
		
		
		
	 1900c04b71
			
		
	
	
		1900c04b71
		
			
		
	
	
	
	
		
			
			Co-authored-by: RMartinOscar <40749467+RMartinOscar@users.noreply.github.com> Co-authored-by: Boy132 <Boy132@users.noreply.github.com> Co-authored-by: Lance Pioch <git@lance.sh>
		
			
				
	
	
		
			64 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			64 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Filament\Server\Pages;
 | |
| 
 | |
| use App\Models\Server;
 | |
| use App\Traits\Filament\BlockAccessInConflict;
 | |
| use App\Traits\Filament\CanCustomizeHeaderActions;
 | |
| use App\Traits\Filament\CanCustomizeHeaderWidgets;
 | |
| use Filament\Facades\Filament;
 | |
| use Filament\Forms\Concerns\InteractsWithForms;
 | |
| use Filament\Pages\Concerns\InteractsWithFormActions;
 | |
| use Filament\Pages\Page;
 | |
| use Filament\Schemas\Schema;
 | |
| 
 | |
| /**
 | |
|  * @property Schema $form
 | |
|  */
 | |
| abstract class ServerFormPage extends Page
 | |
| {
 | |
|     use BlockAccessInConflict;
 | |
|     use CanCustomizeHeaderActions;
 | |
|     use CanCustomizeHeaderWidgets;
 | |
|     use InteractsWithFormActions;
 | |
|     use InteractsWithForms;
 | |
| 
 | |
|     protected string $view = 'filament.server.pages.server-form-page';
 | |
| 
 | |
|     /** @var array<string, mixed>|null */
 | |
|     public ?array $data = [];
 | |
| 
 | |
|     public function mount(): void
 | |
|     {
 | |
|         $this->authorizeAccess();
 | |
| 
 | |
|         $this->fillForm();
 | |
|     }
 | |
| 
 | |
|     public function form(Schema $schema): Schema
 | |
|     {
 | |
|         return $schema
 | |
|             ->statePath('data')
 | |
|             ->model($this->getRecord());
 | |
|     }
 | |
| 
 | |
|     protected function authorizeAccess(): void {}
 | |
| 
 | |
|     protected function fillform(): void
 | |
|     {
 | |
|         $data = $this->getRecord()->attributesToArray();
 | |
| 
 | |
|         $this->form->fill($data);
 | |
|     }
 | |
| 
 | |
|     public function getRecord(): Server
 | |
|     {
 | |
|         /** @var Server $server */
 | |
|         $server = Filament::getTenant();
 | |
| 
 | |
|         return $server;
 | |
|     }
 | |
| 
 | |
|     public function save(): void {}
 | |
| }
 |