authorize('viewAny', [FirewallRule::class, $this->server]); } public function getWidgets(): array { return [ [Widgets\RulesList::class, ['server' => $this->server]], ]; } protected function getHeaderActions(): array { return [ Action::make('read-the-docs') ->label('Read the Docs') ->icon('heroicon-o-document-text') ->color('gray') ->url('https://vitodeploy.com/servers/firewall') ->openUrlInNewTab(), Action::make('create') ->authorize(fn () => auth()->user()?->can('create', [FirewallRule::class, $this->server])) ->label('Create a Rule') ->icon('heroicon-o-plus') ->modalWidth(MaxWidth::Large) ->form([ Select::make('type') ->native(false) ->options([ 'allow' => 'Allow', 'deny' => 'Deny', ]) ->rules(CreateRule::rules()['type']), Select::make('protocol') ->native(false) ->options([ 'tcp' => 'TCP', 'udp' => 'UDP', ]) ->rules(CreateRule::rules()['protocol']), TextInput::make('port') ->rules(CreateRule::rules()['port']), TextInput::make('source') ->rules(CreateRule::rules()['source']), TextInput::make('mask') ->rules(CreateRule::rules()['mask']), ]) ->action(function (array $data) { run_action($this, function () use ($data) { app(CreateRule::class)->create($this->server, $data); $this->dispatch('$refresh'); Notification::make() ->success() ->title('Firewall rule created!') ->send(); }); }), ]; } }