Complete the service option export configuration

This commit is contained in:
Dane Everitt 2017-10-03 20:18:27 -05:00
parent 0d739257a9
commit d608c313c3
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53
6 changed files with 141 additions and 40 deletions

View file

@ -163,7 +163,7 @@ class OptionController extends Controller
*/
public function viewScripts($option)
{
$option = $this->serviceOptionRepository->getWithCopyFrom($option);
$option = $this->serviceOptionRepository->getWithCopyAttributes($option);
$copyOptions = $this->serviceOptionRepository->findWhere([
['copy_script_from', '=', null],
['service_id', '=', $option->service_id],

View file

@ -11,6 +11,7 @@ namespace Pterodactyl\Http\Controllers\Admin\Services\Options;
use Pterodactyl\Models\ServiceOption;
use Pterodactyl\Http\Controllers\Controller;
use Symfony\Component\HttpFoundation\Response;
use Pterodactyl\Services\Services\Exporter\XMLExporterService;
class OptionShareController extends Controller
@ -32,13 +33,16 @@ class OptionShareController extends Controller
/**
* @param \Pterodactyl\Models\ServiceOption $option
* @return $this
* @return \Symfony\Component\HttpFoundation\Response
*
* @throws \Pterodactyl\Exceptions\Repository\RecordNotFoundException
*/
public function export(ServiceOption $option)
public function export(ServiceOption $option): Response
{
return response($this->exporterService->handle($option), 200, [
return response($this->exporterService->handle($option->id), 200, [
'Content-Transfer-Encoding' => 'binary',
'Content-Description' => 'File Transfer',
'Content-Disposition' => 'attachment; filename=' . kebab_case($option->name) . '.xml',
'Content-Type' => 'application/xml',
]);
}