mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-31 02:26:52 +01:00 
			
		
		
		
	 d555c42644
			
		
	
	
		d555c42644
		
			
		
	
	
	
	
		
			
			* update composer.lock * run pint * fix phpstan * update migrations (sqlite `dropForeign`) * fix migrations * Reset these back for now * Alphabetize the rules * run `php artisan filament:upgrade` --------- Co-authored-by: Lance Pioch <git@lance.sh>
		
			
				
	
	
		
			36 lines
		
	
	
		
			866 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			36 lines
		
	
	
		
			866 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Services\Servers;
 | |
| 
 | |
| use App\Enums\ServerState;
 | |
| use App\Models\Server;
 | |
| use Illuminate\Database\ConnectionInterface;
 | |
| use App\Repositories\Daemon\DaemonServerRepository;
 | |
| 
 | |
| class ReinstallServerService
 | |
| {
 | |
|     /**
 | |
|      * ReinstallService constructor.
 | |
|      */
 | |
|     public function __construct(
 | |
|         private ConnectionInterface $connection,
 | |
|         private DaemonServerRepository $daemonServerRepository
 | |
|     ) {}
 | |
| 
 | |
|     /**
 | |
|      * Reinstall a server on the remote daemon.
 | |
|      *
 | |
|      * @throws \Throwable
 | |
|      */
 | |
|     public function handle(Server $server): Server
 | |
|     {
 | |
|         return $this->connection->transaction(function () use ($server) {
 | |
|             $server->fill(['status' => ServerState::Installing])->save();
 | |
| 
 | |
|             $this->daemonServerRepository->setServer($server)->reinstall();
 | |
| 
 | |
|             return $server->refresh();
 | |
|         });
 | |
|     }
 | |
| }
 |