Repository interface improvements
This commit is contained in:
parent
1f4f6024cc
commit
bc3366b10d
23 changed files with 829 additions and 179 deletions
|
@ -25,9 +25,13 @@
|
|||
namespace Pterodactyl\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Sofa\Eloquence\Eloquence;
|
||||
use Sofa\Eloquence\Validable;
|
||||
|
||||
class Database extends Model
|
||||
{
|
||||
use Eloquence, Validable;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
|
@ -61,6 +65,22 @@ class Database extends Model
|
|||
'database_host_id' => 'integer',
|
||||
];
|
||||
|
||||
protected static $applicationRules = [
|
||||
'server_id' => 'required',
|
||||
'database_host_id' => 'required',
|
||||
'database' => 'required',
|
||||
'remote' => 'required',
|
||||
];
|
||||
|
||||
protected static $dataIntegrityRules = [
|
||||
'server_id' => 'numeric|exists:servers,id',
|
||||
'database_host_id' => 'exists:database_hosts,id',
|
||||
'database' => 'string|alpha_dash|between:3,100',
|
||||
'username' => 'string|alpha_dash|between:3,100',
|
||||
'remote' => 'string|regex:/^[0-9%.]{1,15}$/',
|
||||
'password' => 'string',
|
||||
];
|
||||
|
||||
/**
|
||||
* Gets the host database server associated with a database.
|
||||
*
|
||||
|
|
|
@ -24,12 +24,13 @@
|
|||
|
||||
namespace Pterodactyl\Models;
|
||||
|
||||
use Watson\Validating\ValidatingTrait;
|
||||
use Sofa\Eloquence\Eloquence;
|
||||
use Sofa\Eloquence\Validable;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class DatabaseHost extends Model
|
||||
{
|
||||
use ValidatingTrait;
|
||||
use Eloquence, Validable;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
|
@ -65,18 +66,31 @@ class DatabaseHost extends Model
|
|||
'node_id' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
* Application validation rules.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected static $applicationRules = [
|
||||
'name' => 'required',
|
||||
'host' => 'required',
|
||||
'port' => 'required',
|
||||
'username' => 'required',
|
||||
'node_id' => 'sometimes|required',
|
||||
];
|
||||
|
||||
/**
|
||||
* Validation rules to assign to this model.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $rules = [
|
||||
'name' => 'required|string|max:255',
|
||||
'host' => 'required|ip|unique:database_hosts,host',
|
||||
'port' => 'required|numeric|between:1,65535',
|
||||
'username' => 'required|string|max:32',
|
||||
'password' => 'sometimes|nullable|string',
|
||||
'node_id' => 'sometimes|required|nullable|exists:nodes,id',
|
||||
protected static $dataIntegrityRules = [
|
||||
'name' => 'string|max:255',
|
||||
'host' => 'ip|unique:database_hosts,host',
|
||||
'port' => 'numeric|between:1,65535',
|
||||
'username' => 'string|max:32',
|
||||
'password' => 'nullable|string',
|
||||
'node_id' => 'nullable|exists:nodes,id',
|
||||
];
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue