mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-11-04 11:16:51 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			40 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php
 | 
						|
 | 
						|
namespace App\Http\Controllers\Api\Application\Servers;
 | 
						|
 | 
						|
use App\Models\User;
 | 
						|
use App\Models\Server;
 | 
						|
use App\Services\Servers\StartupModificationService;
 | 
						|
use App\Transformers\Api\Application\ServerTransformer;
 | 
						|
use App\Http\Controllers\Api\Application\ApplicationApiController;
 | 
						|
use App\Http\Requests\Api\Application\Servers\UpdateServerStartupRequest;
 | 
						|
 | 
						|
class StartupController extends ApplicationApiController
 | 
						|
{
 | 
						|
    /**
 | 
						|
     * StartupController constructor.
 | 
						|
     */
 | 
						|
    public function __construct(private StartupModificationService $modificationService)
 | 
						|
    {
 | 
						|
        parent::__construct();
 | 
						|
    }
 | 
						|
 | 
						|
    /**
 | 
						|
     * Update the startup and environment settings for a specific server.
 | 
						|
     *
 | 
						|
     * @throws \Illuminate\Validation\ValidationException
 | 
						|
     * @throws \App\Exceptions\Http\Connection\DaemonConnectionException
 | 
						|
     * @throws \App\Exceptions\Model\DataValidationException
 | 
						|
     */
 | 
						|
    public function index(UpdateServerStartupRequest $request, Server $server): array
 | 
						|
    {
 | 
						|
        $server = $this->modificationService
 | 
						|
            ->setUserLevel(User::USER_LEVEL_ADMIN)
 | 
						|
            ->handle($server, $request->validated());
 | 
						|
 | 
						|
        return $this->fractal->item($server)
 | 
						|
            ->transformWith($this->getTransformer(ServerTransformer::class))
 | 
						|
            ->toArray();
 | 
						|
    }
 | 
						|
}
 |