validate($input); $queue = new Queue([ 'server_id' => $queueable instanceof Server ? $queueable->id : $queueable->server_id, 'site_id' => $queueable instanceof Site ? $queueable->id : null, 'command' => $input['command'], 'user' => $input['user'], 'auto_start' => $input['auto_start'], 'auto_restart' => $input['auto_restart'], 'numprocs' => $input['numprocs'], 'status' => QueueStatus::CREATING, ]); $queue->save(); $queue->deploy(); } /** * @throws ValidationException */ protected function validate(array $input): void { $rules = [ 'command' => [ 'required', ], 'user' => [ 'required', 'in:root,'.config('core.ssh_user'), ], 'auto_start' => [ 'required', 'in:0,1', ], 'auto_restart' => [ 'required', 'in:0,1', ], 'numprocs' => [ 'required', 'numeric', 'min:1', ], ]; Validator::make($input, $rules)->validateWithBag('createQueue'); } }