mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-01 05:56:16 +00:00
2.x - firewall/metrics/services/cronjobs
This commit is contained in:
@ -5,7 +5,6 @@
|
||||
use App\Models\SshKey;
|
||||
use App\Models\User;
|
||||
use App\ValidationRules\SshKeyRule;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Validation\ValidationException;
|
||||
|
||||
class CreateSshKey
|
||||
@ -15,8 +14,6 @@ class CreateSshKey
|
||||
*/
|
||||
public function create(User $user, array $input): SshKey
|
||||
{
|
||||
$this->validate($input);
|
||||
|
||||
$key = new SshKey([
|
||||
'user_id' => $user->id,
|
||||
'name' => $input['name'],
|
||||
@ -30,14 +27,14 @@ public function create(User $user, array $input): SshKey
|
||||
/**
|
||||
* @throws ValidationException
|
||||
*/
|
||||
private function validate(array $input): void
|
||||
public static function rules(): array
|
||||
{
|
||||
Validator::make($input, [
|
||||
return [
|
||||
'name' => 'required',
|
||||
'public_key' => [
|
||||
'required',
|
||||
new SshKeyRule,
|
||||
],
|
||||
])->validate();
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user