2023-03-27 08:44:31 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Database\Seeders;
|
|
|
|
|
|
|
|
use App\Models\Application;
|
|
|
|
use App\Models\Environment;
|
2023-03-28 10:09:34 +00:00
|
|
|
use App\Models\GithubApp;
|
2023-03-27 12:31:42 +00:00
|
|
|
use App\Models\StandaloneDocker;
|
2023-03-27 16:14:33 +00:00
|
|
|
use App\Models\SwarmDocker;
|
2023-03-27 08:44:31 +00:00
|
|
|
use Illuminate\Database\Seeder;
|
|
|
|
|
|
|
|
class ApplicationSeeder extends Seeder
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Run the database seeds.
|
|
|
|
*/
|
|
|
|
public function run(): void
|
|
|
|
{
|
|
|
|
$environment_1 = Environment::find(1);
|
2023-03-27 12:31:42 +00:00
|
|
|
$standalone_docker_1 = StandaloneDocker::find(1);
|
2023-03-27 16:14:33 +00:00
|
|
|
$swarm_docker_1 = SwarmDocker::find(1);
|
2023-03-27 12:31:42 +00:00
|
|
|
|
2023-03-28 10:09:34 +00:00
|
|
|
$github_public_source = GithubApp::find(1);
|
2023-03-27 16:14:33 +00:00
|
|
|
Application::create([
|
2023-03-27 08:44:31 +00:00
|
|
|
'id' => 1,
|
|
|
|
'name' => 'My first application',
|
2023-03-27 16:14:33 +00:00
|
|
|
'environment_id' => $environment_1->id,
|
2023-03-27 12:31:42 +00:00
|
|
|
'destination_id' => $standalone_docker_1->id,
|
|
|
|
'destination_type' => StandaloneDocker::class,
|
2023-03-28 10:09:34 +00:00
|
|
|
'source_id' => $github_public_source->id,
|
|
|
|
'source_type' => GithubApp::class,
|
2023-03-27 08:44:31 +00:00
|
|
|
]);
|
2023-03-27 16:14:33 +00:00
|
|
|
Application::create([
|
|
|
|
'id' => 2,
|
2023-03-28 06:28:03 +00:00
|
|
|
'name' => 'My second application (Swarm)',
|
2023-03-27 16:14:33 +00:00
|
|
|
'environment_id' => $environment_1->id,
|
|
|
|
'destination_id' => $swarm_docker_1->id,
|
|
|
|
'destination_type' => SwarmDocker::class,
|
2023-03-28 10:09:34 +00:00
|
|
|
'source_id' => $github_public_source->id,
|
|
|
|
'source_type' => GithubApp::class,
|
2023-03-27 16:14:33 +00:00
|
|
|
]);
|
2023-03-27 08:44:31 +00:00
|
|
|
}
|
|
|
|
}
|