Begin updating UI
This commit is contained in:
parent
493c5888a3
commit
ae671e6b19
22 changed files with 182 additions and 102 deletions
|
@ -31,7 +31,12 @@ class Service extends Model implements CleansAttributes, ValidableContract
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['name', 'author', 'description', 'folder', 'startup', 'index_file'];
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'description',
|
||||
'startup',
|
||||
'index_file',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array
|
||||
|
@ -40,7 +45,6 @@ class Service extends Model implements CleansAttributes, ValidableContract
|
|||
'author' => 'required',
|
||||
'name' => 'required',
|
||||
'description' => 'sometimes',
|
||||
'folder' => 'required',
|
||||
'startup' => 'sometimes',
|
||||
'index_file' => 'required',
|
||||
];
|
||||
|
@ -49,10 +53,9 @@ class Service extends Model implements CleansAttributes, ValidableContract
|
|||
* @var array
|
||||
*/
|
||||
protected static $dataIntegrityRules = [
|
||||
'author' => 'string|size:36',
|
||||
'author' => 'email',
|
||||
'name' => 'string|max:255',
|
||||
'description' => 'nullable|string',
|
||||
'folder' => 'string|max:255|regex:/^[\w.-]{1,50}$/|unique:services,folder',
|
||||
'startup' => 'nullable|string',
|
||||
'index_file' => 'string',
|
||||
];
|
||||
|
@ -74,12 +77,7 @@ class Service extends Model implements CleansAttributes, ValidableContract
|
|||
*/
|
||||
public function packs()
|
||||
{
|
||||
return $this->hasManyThrough(
|
||||
Pack::class,
|
||||
ServiceOption::class,
|
||||
'service_id',
|
||||
'option_id'
|
||||
);
|
||||
return $this->hasManyThrough(Pack::class, ServiceOption::class, 'service_id', 'option_id');
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -31,7 +31,22 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
|
|||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $guarded = ['id', 'created_at', 'updated_at'];
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'description',
|
||||
'docker_image',
|
||||
'config_files',
|
||||
'config_startup',
|
||||
'config_logs',
|
||||
'config_stop',
|
||||
'config_from',
|
||||
'startup',
|
||||
'script_is_privileged',
|
||||
'script_install',
|
||||
'script_entry',
|
||||
'script_container',
|
||||
'copy_script_from',
|
||||
];
|
||||
|
||||
/**
|
||||
* Cast values to correct type.
|
||||
|
@ -40,7 +55,9 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
|
|||
*/
|
||||
protected $casts = [
|
||||
'service_id' => 'integer',
|
||||
'config_from' => 'integer',
|
||||
'script_is_privileged' => 'boolean',
|
||||
'copy_script_from' => 'integer',
|
||||
];
|
||||
|
||||
/**
|
||||
|
@ -48,6 +65,7 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
|
|||
*/
|
||||
protected static $applicationRules = [
|
||||
'service_id' => 'required',
|
||||
'author' => 'required',
|
||||
'name' => 'required',
|
||||
'description' => 'required',
|
||||
'tag' => 'required',
|
||||
|
@ -64,13 +82,14 @@ class ServiceOption extends Model implements CleansAttributes, ValidableContract
|
|||
* @var array
|
||||
*/
|
||||
protected static $dataIntegrityRules = [
|
||||
'service_id' => 'numeric|exists:services,id',
|
||||
'service_id' => 'bail|numeric|exists:services,id',
|
||||
'author' => 'email',
|
||||
'name' => 'string|max:255',
|
||||
'description' => 'string',
|
||||
'tag' => 'alpha_num|max:60|unique:service_options,tag',
|
||||
'tag' => 'bail|alpha_num|max:60|unique:service_options,tag',
|
||||
'docker_image' => 'string|max:255',
|
||||
'startup' => 'nullable|string',
|
||||
'config_from' => 'nullable|numeric|exists:service_options,id',
|
||||
'config_from' => 'bail|nullable|numeric|exists:service_options,id',
|
||||
'config_stop' => 'nullable|string|max:255',
|
||||
'config_startup' => 'nullable|json',
|
||||
'config_logs' => 'nullable|json',
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue