Fix service creation/updates, closes #306
This commit is contained in:
parent
99497adcb2
commit
824041f6ca
3 changed files with 10 additions and 5 deletions
|
@ -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();
|
||||
|
|
Reference in a new issue