mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-21 10:51:36 +00:00
33 lines
729 B
PHP
33 lines
729 B
PHP
<?php
|
|
|
|
namespace App\Actions\StorageProvider;
|
|
|
|
use App\Models\Project;
|
|
use App\Models\StorageProvider;
|
|
use Illuminate\Validation\ValidationException;
|
|
|
|
class EditStorageProvider
|
|
{
|
|
public function edit(StorageProvider $storageProvider, Project $project, array $input): StorageProvider
|
|
{
|
|
$storageProvider->profile = $input['name'];
|
|
$storageProvider->project_id = isset($input['global']) && $input['global'] ? null : $project->id;
|
|
|
|
$storageProvider->save();
|
|
|
|
return $storageProvider;
|
|
}
|
|
|
|
/**
|
|
* @throws ValidationException
|
|
*/
|
|
public static function rules(): array
|
|
{
|
|
return [
|
|
'name' => [
|
|
'required',
|
|
],
|
|
];
|
|
}
|
|
}
|