mirror of
				https://github.com/pelican-dev/panel.git
				synced 2025-10-30 04:16:51 +01:00 
			
		
		
		
	 e1308cb04d
			
		
	
	
		e1308cb04d
		
			
		
	
	
	
	
		
			
			* update scramble * cleanup application api endpoints * cleanup client api endpoints * fix security schema and make docs homepage nicer * remove duplicate myclabs/deep-copy * style(api-docs): use Blade template and Tailwind for styling * Publish scramble view * Use localStorage theme instead of config * Update routes/docs.php Co-authored-by: Lance Pioch <git@lance.sh> --------- Co-authored-by: Quinten <67589015+QuintenQVD0@users.noreply.github.com> Co-authored-by: RMartinOscar <40749467+RMartinOscar@users.noreply.github.com> Co-authored-by: Lance Pioch <git@lance.sh>
		
			
				
	
	
		
			40 lines
		
	
	
		
			1010 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			40 lines
		
	
	
		
			1010 B
		
	
	
	
		
			PHP
		
	
	
	
	
	
| <?php
 | |
| 
 | |
| namespace App\Http\Controllers\Api\Client\Servers;
 | |
| 
 | |
| use Illuminate\Http\Response;
 | |
| use App\Models\Server;
 | |
| use App\Facades\Activity;
 | |
| use App\Repositories\Daemon\DaemonPowerRepository;
 | |
| use App\Http\Controllers\Api\Client\ClientApiController;
 | |
| use App\Http\Requests\Api\Client\Servers\SendPowerRequest;
 | |
| use Dedoc\Scramble\Attributes\Group;
 | |
| 
 | |
| #[Group('Server', weight: 2)]
 | |
| class PowerController extends ClientApiController
 | |
| {
 | |
|     /**
 | |
|      * PowerController constructor.
 | |
|      */
 | |
|     public function __construct(private DaemonPowerRepository $repository)
 | |
|     {
 | |
|         parent::__construct();
 | |
|     }
 | |
| 
 | |
|     /**
 | |
|      * Send power action
 | |
|      *
 | |
|      * Send a power action to a server.
 | |
|      */
 | |
|     public function index(SendPowerRequest $request, Server $server): Response
 | |
|     {
 | |
|         $this->repository->setServer($server)->send(
 | |
|             $request->input('signal')
 | |
|         );
 | |
| 
 | |
|         Activity::event(strtolower("server:power.{$request->input('signal')}"))->log();
 | |
| 
 | |
|         return $this->returnNoContent();
 | |
|     }
 | |
| }
 |