mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-17 17:01:37 +00:00
29 lines
715 B
PHP
Executable File
29 lines
715 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Actions\StorageProvider;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Support\Facades\Validator;
|
|
use Illuminate\Validation\Rule;
|
|
use Illuminate\Validation\ValidationException;
|
|
|
|
trait ValidateProvider
|
|
{
|
|
/**
|
|
* @throws ValidationException
|
|
*/
|
|
private function validate(User $user, array $input): void
|
|
{
|
|
Validator::make($input, [
|
|
'label' => [
|
|
'required',
|
|
Rule::unique('storage_providers', 'label')->where('user_id', $user->id),
|
|
],
|
|
'provider' => [
|
|
'required',
|
|
Rule::in(config('core.storage_providers')),
|
|
],
|
|
])->validateWithBag('addStorageProvider');
|
|
}
|
|
}
|