1
1
mirror of https://github.com/pterodactyl/panel.git synced 2024-11-22 17:12:30 +01:00

Fix service creation/updates, closes #306

This commit is contained in:
Dane Everitt 2017-02-17 20:40:50 -05:00
parent 99497adcb2
commit 824041f6ca
No known key found for this signature in database
GPG Key ID: EEA66103B3D71F53
3 changed files with 10 additions and 5 deletions

View File

@ -12,6 +12,7 @@ This project follows [Semantic Versioning](http://semver.org) guidelines.
* `[pre.2]` — Fixes inability to delete accounts due to SQL changes.
* `[pre.2]` — Fixes bug with checking power-permissions that showed the wrong buttons. Also adds check back to sidebar to only show options a user can use.
* `[pre.2]` — Fixes allocation listing on node allocations tab as well as bug preventing deletion of port.
* `[pre.2]` — Fixes bug in services that prevented saving updated settings or creating new services.
### Changed
* `[pre.2]` — File Manager now displays relevant information on all screen sizes, and includes better button clicking mechanics for dropdown menu.

View File

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

View File

@ -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();