Some service host/domain updates, including schema updates
This commit is contained in:
@@ -228,41 +228,6 @@ class ServiceController extends Controller
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Edit a domain service details
|
||||
*
|
||||
* @param Request $request
|
||||
* @param Service $o
|
||||
* @return RedirectResponse
|
||||
* @deprecated - use update()
|
||||
*/
|
||||
public function domain_edit(Request $request,Service $o)
|
||||
{
|
||||
session()->flash('service_update',TRUE);
|
||||
|
||||
$validation = $request->validate([
|
||||
'service.domain_name' => ['required',function($attribute,$value,$fail) use ($request,$o) {
|
||||
if (Service\Domain::where('domain_name',$value)
|
||||
->where('domain_tld_id',Arr::get($request,'service.domain_tld_id'))
|
||||
->when($o->type,function($q) use ($o) { return $q->where('id','<>',$o->type->id); })
|
||||
->count() > 0)
|
||||
{
|
||||
$fail('Domain already exists.');
|
||||
}
|
||||
}],
|
||||
'service.domain_expire' => 'required|date',
|
||||
'service.domain_tld_id' => 'required|exists:ab_domain_tld,id',
|
||||
'service.domain_registrar_id' => 'required|exists:ab_domain_registrar,id',
|
||||
'service.registrar_account' => 'required',
|
||||
'service.registrar_username' => 'required|string|min:5',
|
||||
'service.registrar_ns' => 'required|string|min:5',
|
||||
]);
|
||||
|
||||
$o->type->forceFill($validation['service'])->save();
|
||||
|
||||
return redirect()->back()->with('success','Record updated.');
|
||||
}
|
||||
|
||||
/**
|
||||
* List all the domains managed by the user
|
||||
*
|
||||
|
@@ -5,12 +5,7 @@ namespace App\Models;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Leenooks\Traits\ScopeActive;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
class DomainRegistrar extends Model
|
||||
{
|
||||
use ScopeActive;
|
||||
|
||||
protected $table = 'ab_domain_registrar';
|
||||
}
|
@@ -1,35 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Leenooks\Traits\ScopeActive;
|
||||
|
||||
/**
|
||||
* @deprecated
|
||||
*/
|
||||
class DomainTld extends Model
|
||||
{
|
||||
use ScopeActive;
|
||||
|
||||
protected $table = 'ab_domain_tld';
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
public function services()
|
||||
{
|
||||
return $this->hasMany(Service::class);
|
||||
}
|
||||
|
||||
/* ATTRIBUTES */
|
||||
|
||||
public function getNameAttribute($value): string
|
||||
{
|
||||
return strtoupper($value);
|
||||
}
|
||||
|
||||
public function getPriceGroupAttribute($value): array
|
||||
{
|
||||
return unserialize($value);
|
||||
}
|
||||
}
|
@@ -1,10 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class HostServer extends Model
|
||||
{
|
||||
protected $table = 'ab_host_server';
|
||||
}
|
@@ -16,6 +16,26 @@ class Domain extends Type
|
||||
protected $table = 'service_domain';
|
||||
protected $with = ['tld'];
|
||||
|
||||
/* OVERRIDES */
|
||||
|
||||
/**
|
||||
* Service update validation
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function validation(): array
|
||||
{
|
||||
return [
|
||||
'domain_name' => 'nullable|string|min:2',
|
||||
'tld_id' => 'required|exists:tlds,id',
|
||||
'expire_at' => 'required|date',
|
||||
'domain_registrar_id' => 'required|exists:domain_registrars,id',
|
||||
'registrar_account' => 'nullable|string',
|
||||
'registrar_ns' => 'nullable|string',
|
||||
'registrar_username' => 'nullable|string',
|
||||
];
|
||||
}
|
||||
|
||||
/* RELATIONS */
|
||||
|
||||
public function registrar()
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace App\Models\Service;
|
||||
|
||||
use App\Models\HostServer;
|
||||
use App\Models\SupplierHostServer;
|
||||
use App\Traits\ServiceDomains;
|
||||
|
||||
/**
|
||||
@@ -20,6 +20,25 @@ class Host extends Type
|
||||
|
||||
public function provider()
|
||||
{
|
||||
return $this->belongsTo(HostServer::class,'host_server_id');
|
||||
return $this->belongsTo(SupplierHostServer::class,'supplier_host_server_id');
|
||||
}
|
||||
|
||||
/* OVERRIDES */
|
||||
|
||||
/**
|
||||
* Service update validation
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function validation(): array
|
||||
{
|
||||
return [
|
||||
'domain_name' => 'nullable|string|min:2',
|
||||
'tld_id' => 'required|exists:tlds,id',
|
||||
'expire_at' => 'required|date',
|
||||
'supplier_host_server_id' => 'required|exists:supplier_host_servers,id',
|
||||
'host_username' => 'nullable|string',
|
||||
'host_password' => 'nullable|string',
|
||||
];
|
||||
}
|
||||
}
|
11
app/Models/SupplierHostServer.php
Normal file
11
app/Models/SupplierHostServer.php
Normal file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Leenooks\Traits\ScopeActive;
|
||||
|
||||
class SupplierHostServer extends Model
|
||||
{
|
||||
use ScopeActive;
|
||||
}
|
Reference in New Issue
Block a user