mirror of
https://github.com/pelican-dev/panel.git
synced 2025-05-20 08:44:46 +02:00
34 lines
1004 B
PHP
34 lines
1004 B
PHP
<?php
|
|
|
|
namespace App\Services\Eggs\Scripts;
|
|
|
|
use App\Models\Egg;
|
|
use App\Contracts\Repository\EggRepositoryInterface;
|
|
|
|
class InstallScriptService
|
|
{
|
|
/**
|
|
* InstallScriptService constructor.
|
|
*/
|
|
public function __construct(protected EggRepositoryInterface $repository)
|
|
{
|
|
}
|
|
|
|
/**
|
|
* Modify the install script for a given Egg.
|
|
*
|
|
* @throws \App\Exceptions\Model\DataValidationException
|
|
* @throws \App\Exceptions\Repository\RecordNotFoundException
|
|
*/
|
|
public function handle(Egg $egg, array $data): void
|
|
{
|
|
$this->repository->withoutFreshModel()->update($egg->id, [
|
|
'script_install' => array_get($data, 'script_install'),
|
|
'script_is_privileged' => array_get($data, 'script_is_privileged', 1),
|
|
'script_entry' => array_get($data, 'script_entry'),
|
|
'script_container' => array_get($data, 'script_container'),
|
|
'copy_script_from' => array_get($data, 'copy_script_from'),
|
|
]);
|
|
}
|
|
}
|