mirror of
https://github.com/vitodeploy/vito.git
synced 2025-04-20 02:11:36 +00:00
50 lines
1.2 KiB
PHP
50 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\SourceControl;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
class SourceControlFactory extends Factory
|
|
{
|
|
protected $model = SourceControl::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'access_token' => Str::random(10),
|
|
'provider' => \App\Enums\SourceControl::GITHUB,
|
|
'profile' => $this->faker->name,
|
|
'project_id' => null,
|
|
];
|
|
}
|
|
|
|
public function gitlab(): Factory
|
|
{
|
|
return $this->state(function (array $attributes) {
|
|
return [
|
|
'provider' => \App\Enums\SourceControl::GITLAB,
|
|
];
|
|
});
|
|
}
|
|
|
|
public function github(): Factory
|
|
{
|
|
return $this->state(function (array $attributes) {
|
|
return [
|
|
'provider' => \App\Enums\SourceControl::GITHUB,
|
|
];
|
|
});
|
|
}
|
|
|
|
public function bitbucket(): Factory
|
|
{
|
|
return $this->state(function (array $attributes) {
|
|
return [
|
|
'provider' => \App\Enums\SourceControl::BITBUCKET,
|
|
];
|
|
});
|
|
}
|
|
}
|