API Feature (#334)

This commit is contained in:
Saeed Vaziry
2024-11-01 16:49:57 +01:00
committed by GitHub
parent da7b24640e
commit 417bf73e44
143 changed files with 36520 additions and 586 deletions

View File

@ -2,6 +2,7 @@
namespace App\Actions\SourceControl;
use App\Models\Project;
use App\Models\SourceControl;
use App\Models\User;
use Illuminate\Support\Arr;
@ -10,13 +11,13 @@
class ConnectSourceControl
{
public function connect(User $user, array $input): void
public function connect(User $user, Project $project, array $input): SourceControl
{
$sourceControl = new SourceControl([
'provider' => $input['provider'],
'profile' => $input['name'],
'url' => Arr::has($input, 'url') ? $input['url'] : null,
'project_id' => isset($input['global']) && $input['global'] ? null : $user->current_project_id,
'project_id' => isset($input['global']) && $input['global'] ? null : $project->id,
]);
$sourceControl->provider_data = $sourceControl->provider()->createData($input);
@ -29,6 +30,8 @@ public function connect(User $user, array $input): void
}
$sourceControl->save();
return $sourceControl;
}
public static function rules(array $input): array