Fix service creation/updates, closes #306
This commit is contained in:
parent
99497adcb2
commit
824041f6ca
3 changed files with 10 additions and 5 deletions
|
@ -36,11 +36,13 @@ class Service extends Model
|
|||
protected $table = 'services';
|
||||
|
||||
/**
|
||||
* Fields that are not mass assignable.
|
||||
* Fields that are mass assignable.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = ['id', 'created_at', 'updated_at'];
|
||||
protected $fillable = [
|
||||
'name', 'description', 'file', 'executable', 'startup',
|
||||
];
|
||||
|
||||
/**
|
||||
* Gets all service options associated with this service.
|
||||
|
|
|
@ -53,11 +53,13 @@ class Service
|
|||
throw new DisplayValidationException($validator->errors());
|
||||
}
|
||||
|
||||
$data['author'] = env('SERVICE_AUTHOR', (string) Uuid::generate(4));
|
||||
|
||||
DB::beginTransaction();
|
||||
try {
|
||||
$service = Models\Service::create($data);
|
||||
$service = new Models\Service;
|
||||
$service->author = env('SERVICE_AUTHOR', (string) Uuid::generate(4));
|
||||
$service->fill($data);
|
||||
$service->save();
|
||||
|
||||
Storage::put('services/' . $service->file . '/main.json', '{}');
|
||||
Storage::copy('services/.templates/index.js', 'services/' . $service->file . '/index.js');
|
||||
DB::commit();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue