2.x - backups

This commit is contained in:
Saeed Vaziry
2024-09-29 17:54:11 +02:00
parent e4fed24498
commit 2e9620409b
35 changed files with 1093 additions and 122 deletions

View File

@ -4,15 +4,12 @@
use App\Models\StorageProvider;
use App\Models\User;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\ValidationException;
class EditStorageProvider
{
public function edit(StorageProvider $storageProvider, User $user, array $input): void
{
$this->validate($input);
$storageProvider->profile = $input['name'];
$storageProvider->project_id = isset($input['global']) && $input['global'] ? null : $user->current_project_id;
@ -22,13 +19,12 @@ public function edit(StorageProvider $storageProvider, User $user, array $input)
/**
* @throws ValidationException
*/
private function validate(array $input): void
public static function rules(): array
{
$rules = [
return [
'name' => [
'required',
],
];
Validator::make($input, $rules)->validate();
}
}