Fix for when no zones/echoareas have been created yet in a domain
This commit is contained in:
parent
c414ebd053
commit
31770241ec
@ -10,7 +10,7 @@ use App\Models\{Address,Zone};
|
|||||||
class ZoneController extends Controller
|
class ZoneController extends Controller
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Add or edit a node
|
* Add or edit a zone
|
||||||
*/
|
*/
|
||||||
public function add_edit(Request $request,Zone $o)
|
public function add_edit(Request $request,Zone $o)
|
||||||
{
|
{
|
||||||
|
@ -24,8 +24,25 @@ class DomainRequest extends FormRequest
|
|||||||
$o = $this->route('o');
|
$o = $this->route('o');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'name' => 'required|max:8|regex:/^[a-z-_~]{1,8}$/|unique:domains,name,'.($o->exists ? $o->id : 0),
|
'name' => [
|
||||||
'dnsdomain' => 'nullable|regex:/^(?!:\/\/)(?=.{1,255}$)((.{1,63}\.){1,127}(?![0-9]*$)[a-z0-9-]+\.?)$/i|unique:domains,dnsdomain,'.($o->exists ? $o->id : NULL),
|
'required',
|
||||||
|
'max:8',
|
||||||
|
'regex:/^[a-z-_~]{1,8}$/',
|
||||||
|
Rule::unique('domains')
|
||||||
|
->where(fn($query)=>$query
|
||||||
|
->where('name',$request->post('name'))
|
||||||
|
->when($o?->exists,fn($query)=>$query->where('id','<>',$o->id))
|
||||||
|
)
|
||||||
|
],
|
||||||
|
'dnsdomain' => [
|
||||||
|
'nullable',
|
||||||
|
'regex:/^(?!:\/\/)(?=.{1,255}$)((.{1,63}\.){1,127}(?![0-9]*$)[a-z0-9-]+\.?)$/i',
|
||||||
|
Rule::unique('domains')
|
||||||
|
->where(fn($query)=>$query
|
||||||
|
->where('dnsdomain',$request->post('dnsdomain'))
|
||||||
|
->when($o?->exists,fn($query)=>$query->where('id','<>',$o->id))
|
||||||
|
)
|
||||||
|
],
|
||||||
'active' => 'required|boolean',
|
'active' => 'required|boolean',
|
||||||
'public' => 'required|boolean',
|
'public' => 'required|boolean',
|
||||||
'accept_app' => 'required|boolean',
|
'accept_app' => 'required|boolean',
|
||||||
@ -33,7 +50,7 @@ class DomainRequest extends FormRequest
|
|||||||
'nodestatus_id' => [
|
'nodestatus_id' => [
|
||||||
'nullable',
|
'nullable',
|
||||||
Rule::exists(Echoarea::class,'id'),
|
Rule::exists(Echoarea::class,'id'),
|
||||||
Rule::in($o->echoareas->pluck('id')),
|
Rule::in($o?->echoareas->pluck('id')),
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
@ -8,12 +8,10 @@ use Illuminate\Support\Facades\Gate;
|
|||||||
use Illuminate\Validation\Rule;
|
use Illuminate\Validation\Rule;
|
||||||
|
|
||||||
use App\Classes\FTN\Packet;
|
use App\Classes\FTN\Packet;
|
||||||
use App\Models\{Setup,System};
|
use App\Models\Setup;
|
||||||
|
|
||||||
class SystemRegisterRequest extends FormRequest
|
class SystemRegisterRequest extends FormRequest
|
||||||
{
|
{
|
||||||
private System $so;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Determine if the user is authorized to make this request.
|
* Determine if the user is authorized to make this request.
|
||||||
*
|
*
|
||||||
|
@ -69,7 +69,8 @@ class Domain extends Model
|
|||||||
|
|
||||||
public function getCanAcceptAppAttribute(): bool
|
public function getCanAcceptAppAttribute(): bool
|
||||||
{
|
{
|
||||||
return our_address($this)->count()
|
return ($x=our_address($this))
|
||||||
|
&& $x->count()
|
||||||
&& $this->active
|
&& $this->active
|
||||||
&& $this->accept_app
|
&& $this->accept_app
|
||||||
&& Auth::id()
|
&& Auth::id()
|
||||||
|
@ -47,7 +47,7 @@ use App\Models\Echoarea;
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-2">
|
<div class="col-2">
|
||||||
@if ($o->zones->count() > 1)
|
@if ($o->zones?->count() > 1)
|
||||||
<label class="form-label">Flatten Zones <i class="bi bi-info-circle" title="Treat this domain as a 2D domain"></i></label>
|
<label class="form-label">Flatten Zones <i class="bi bi-info-circle" title="Treat this domain as a 2D domain"></i></label>
|
||||||
<div class="input-group">
|
<div class="input-group">
|
||||||
<div class="btn-group" role="group">
|
<div class="btn-group" role="group">
|
||||||
|
Loading…
Reference in New Issue
Block a user