mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-21 19:01:37 +00:00
36 lines
701 B
PHP
36 lines
701 B
PHP
<?php
|
|
|
|
namespace App\Actions\Site;
|
|
|
|
use App\Models\Command;
|
|
use App\Models\Site;
|
|
|
|
class CreateCommand
|
|
{
|
|
/**
|
|
* @param array<string, mixed> $input
|
|
*/
|
|
public function create(Site $site, array $input): Command
|
|
{
|
|
$script = new Command([
|
|
'site_id' => $site->id,
|
|
'name' => $input['name'],
|
|
'command' => $input['command'],
|
|
]);
|
|
$script->save();
|
|
|
|
return $script;
|
|
}
|
|
|
|
/**
|
|
* @return array<string, array<string>>
|
|
*/
|
|
public static function rules(): array
|
|
{
|
|
return [
|
|
'name' => ['required', 'string', 'max:255'],
|
|
'command' => ['required', 'string'],
|
|
];
|
|
}
|
|
}
|