mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 22:46:16 +00:00
init
This commit is contained in:
28
app/Actions/StorageProvider/ValidateProvider.php
Executable file
28
app/Actions/StorageProvider/ValidateProvider.php
Executable file
@ -0,0 +1,28 @@
|
||||
<?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');
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user