PortIO/app/Models/Server.php

56 lines
1.0 KiB
PHP
Raw Normal View History

2023-03-15 13:45:41 +00:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\HasMany;
class Server extends Model
{
2023-05-14 07:42:18 +00:00
protected $hidden = [
2023-03-15 13:45:41 +00:00
'dashboard_password',
'dashboard_user',
2023-05-14 07:42:18 +00:00
'dashboard_port',
'key'
2023-03-15 13:45:41 +00:00
];
2023-08-12 12:29:49 +00:00
2023-03-15 13:45:41 +00:00
protected $fillable = [
'name',
2023-05-14 07:42:18 +00:00
'key',
2023-03-15 13:45:41 +00:00
'server_address',
'server_port',
'token',
'dashboard_port',
'dashboard_user',
'dashboard_password',
'allow_http',
'allow_https',
'allow_tcp',
'allow_udp',
'allow_stcp',
'allow_sudp',
'allow_xtcp',
'min_port',
'max_port',
'max_tunnels',
'is_china_mainland',
2023-05-14 07:42:18 +00:00
'status'
2023-03-15 13:45:41 +00:00
];
// tunnels
protected static function booted()
{
static::creating(function ($server) {
// $server->key = Str::random(32);
});
}
// on create
public function tunnels(): HasMany
{
return $this->hasMany(Tunnel::class);
}
}