mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 22:46:16 +00:00
Merge (#127)
This commit is contained in:
@ -2,9 +2,6 @@
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use App\Enums\FirewallRuleStatus;
|
||||
use App\Jobs\Firewall\AddToServer;
|
||||
use App\Jobs\Firewall\RemoveFromServer;
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
@ -12,7 +9,6 @@
|
||||
* @property int $server_id
|
||||
* @property string $type
|
||||
* @property string $protocol
|
||||
* @property string $real_protocol
|
||||
* @property int $port
|
||||
* @property string $source
|
||||
* @property ?string $mask
|
||||
@ -40,28 +36,12 @@ class FirewallRule extends AbstractModel
|
||||
'port' => 'integer',
|
||||
];
|
||||
|
||||
protected $appends = [
|
||||
'real_protocol',
|
||||
];
|
||||
|
||||
public function server(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Server::class);
|
||||
}
|
||||
|
||||
public function addToServer(): void
|
||||
{
|
||||
dispatch(new AddToServer($this))->onConnection('ssh');
|
||||
}
|
||||
|
||||
public function removeFromServer(): void
|
||||
{
|
||||
$this->status = FirewallRuleStatus::DELETING;
|
||||
$this->save();
|
||||
dispatch(new RemoveFromServer($this))->onConnection('ssh');
|
||||
}
|
||||
|
||||
public function getRealProtocolAttribute(): string
|
||||
public function getRealProtocol(): string
|
||||
{
|
||||
return $this->protocol === 'udp' ? 'udp' : 'tcp';
|
||||
}
|
||||
|
Reference in New Issue
Block a user