Repository interface improvements

This commit is contained in:
Dane Everitt
2017-07-15 11:52:34 -05:00
parent 1f4f6024cc
commit bc3366b10d
23 changed files with 829 additions and 179 deletions

View File

@@ -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.
*