This commit is contained in:
Saeed Vaziry
2023-07-02 12:47:50 +02:00
commit 5c72f12490
825 changed files with 41659 additions and 0 deletions

View File

@ -0,0 +1,15 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class BackupFactory extends Factory
{
public function definition(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class BackupFileFactory extends Factory
{
public function definition(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use App\Enums\CronjobStatus;
use App\Models\CronJob;
use Illuminate\Database\Eloquent\Factories\Factory;
class CronJobFactory extends Factory
{
protected $model = CronJob::class;
public function definition(): array
{
return [
'command' => 'ls -la',
'user' => 'root',
'frequency' => '* * * * *',
'hidden' => false,
'status' => CronjobStatus::READY,
];
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace Database\Factories;
use App\Enums\DatabaseStatus;
use App\Models\Database;
use Illuminate\Database\Eloquent\Factories\Factory;
class DatabaseFactory extends Factory
{
protected $model = Database::class;
public function definition(): array
{
return [
'name' => $this->faker->userName,
'status' => DatabaseStatus::READY,
];
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace Database\Factories;
use App\Models\DatabaseUser;
use Illuminate\Database\Eloquent\Factories\Factory;
class DatabaseUserFactory extends Factory
{
protected $model = DatabaseUser::class;
public function definition(): array
{
return [
'username' => $this->faker->userName,
'password' => 'password',
'databases' => [],
'host' => '%',
];
}
}

View File

@ -0,0 +1,18 @@
<?php
namespace Database\Factories;
use App\Models\Deployment;
use Illuminate\Database\Eloquent\Factories\Factory;
class DeploymentFactory extends Factory
{
protected $model = Deployment::class;
public function definition(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,24 @@
<?php
namespace Database\Factories;
use App\Models\DeploymentScript;
use App\Models\Site;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
class DeploymentScriptFactory extends Factory
{
protected $model = DeploymentScript::class;
public function definition(): array
{
return [
'name' => $this->faker->name(),
'content' => $this->faker->word(),
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
'site_id' => Site::factory(),
];
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use App\Models\FirewallRule;
use Illuminate\Database\Eloquent\Factories\Factory;
class FirewallRuleFactory extends Factory
{
protected $model = FirewallRule::class;
public function definition(): array
{
return [
'type' => 'allow',
'protocol' => 'tcp',
'port' => $this->faker->numberBetween(1, 65535),
'source' => $this->faker->ipv4(),
'mask' => 24,
'note' => 'test',
];
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class NotificationChannelFactory extends Factory
{
public function definition(): array
{
return [
'label' => $this->faker->text(10),
'provider' => 'email',
'data' => [
'email' => $this->faker->email,
],
'connected' => 1,
];
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Database\Factories;
use App\Enums\QueueStatus;
use App\Models\Queue;
use Illuminate\Database\Eloquent\Factories\Factory;
class QueueFactory extends Factory
{
protected $model = Queue::class;
public function definition(): array
{
return [
'command' => 'php artisan queue:work',
'user' => 'vito',
'auto_start' => 1,
'auto_restart' => 1,
'numprocs' => 1,
'redirect_stderr' => 1,
'stdout_logfile' => 'file.log',
'status' => QueueStatus::CREATING,
];
}
}

View File

@ -0,0 +1,25 @@
<?php
namespace Database\Factories;
use App\Models\Redirect;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
class RedirectFactory extends Factory
{
protected $model = Redirect::class;
public function definition(): array
{
return [
'site_id' => $this->faker->randomNumber(),
'mode' => $this->faker->randomNumber(),
'from' => $this->faker->word(),
'to' => $this->faker->word(),
'status' => $this->faker->word(),
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
];
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Database\Factories;
use App\Models\Script;
use App\Models\ScriptExecution;
use App\Models\Server;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
class ScriptExecutionFactory extends Factory
{
protected $model = ScriptExecution::class;
public function definition(): array
{
return [
'user' => $this->faker->word(),
'finished_at' => Carbon::now(),
'created_at' => Carbon::now(),
'updated_at' => Carbon::now(),
'script_id' => Script::factory(),
'server_id' => Server::factory(),
];
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class ScriptFactory extends Factory
{
public function definition(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,41 @@
<?php
namespace Database\Factories;
use App\Enums\OperatingSystem;
use App\Enums\ServerProvider;
use App\Enums\ServerStatus;
use App\Enums\ServerType;
use App\Models\Server;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class ServerFactory extends Factory
{
protected $model = Server::class;
public function definition(): array
{
/** @var User $user */
$user = User::factory()->create();
return [
'user_id' => $user->id,
'name' => $this->faker->name(),
'ssh_user' => 'vito',
'ip' => $this->faker->ipv4(),
'local_ip' => $this->faker->ipv4(),
'port' => 22,
'os' => OperatingSystem::UBUNTU22,
'type' => ServerType::REGULAR,
'provider' => ServerProvider::CUSTOM,
'authentication' => [
'user' => 'vito',
'pass' => 'password',
],
'public_key' => 'test',
'status' => ServerStatus::READY,
'progress' => 100,
];
}
}

View File

@ -0,0 +1,21 @@
<?php
namespace Database\Factories;
use App\Enums\LogType;
use App\Models\ServerLog;
use Illuminate\Database\Eloquent\Factories\Factory;
class ServerLogFactory extends Factory
{
protected $model = ServerLog::class;
public function definition(): array
{
return [
'type' => 'test-log',
'name' => 'test.log',
'disk' => 'server-logs-local',
];
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use App\Models\ServerProvider;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class ServerProviderFactory extends Factory
{
protected $model = ServerProvider::class;
public function definition(): array
{
return [
'profile' => $this->faker->word(),
'provider' => $this->faker->randomElement(\App\Enums\ServerProvider::getValues()),
'credentials' => [],
'connected' => 1,
'user_id' => User::factory(),
];
}
}

View File

@ -0,0 +1,19 @@
<?php
namespace Database\Factories;
use App\Models\Server;
use App\Models\Service;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
class ServiceFactory extends Factory
{
protected $model = Service::class;
public function definition(): array
{
return [
];
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Database\Factories;
use App\Enums\SiteType;
use App\Models\Site;
use Illuminate\Database\Eloquent\Factories\Factory;
class SiteFactory extends Factory
{
protected $model = Site::class;
public function definition(): array
{
return [
'type' => SiteType::LARAVEL,
'domain' => 'test.com',
'web_directory' => '/',
'path' => '/home',
'status' => 'ready',
'progress' => '100',
'php_version' => '8.2',
'branch' => 'main'
];
}
}

View File

@ -0,0 +1,20 @@
<?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 [
'provider' => $this->faker->randomElement(\App\Enums\SourceControl::getValues()),
'access_token' => Str::random(10),
];
}
}

View File

@ -0,0 +1,20 @@
<?php
namespace Database\Factories;
use App\Models\SshKey;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
class SshKeyFactory extends Factory
{
protected $model = SshKey::class;
public function definition(): array
{
return [
'name' => $this->faker->name(),
'public_key' => 'public-key-content',
];
}
}

View File

@ -0,0 +1,26 @@
<?php
namespace Database\Factories;
use App\Enums\SslStatus;
use App\Models\Ssl;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
class SslFactory extends Factory
{
protected $model = Ssl::class;
public function definition(): array
{
return [
'type' => $this->faker->word(),
'certificate' => $this->faker->word(),
'pk' => $this->faker->word(),
'ca' => $this->faker->word(),
'expires_at' => Carbon::now()->addDay(),
'status' => SslStatus::CREATED,
'domains' => 'example.com',
];
}
}

View File

@ -0,0 +1,15 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
class StorageProviderFactory extends Factory
{
public function definition(): array
{
return [
//
];
}
}

View File

@ -0,0 +1,23 @@
<?php
namespace Database\Factories;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class UserFactory extends Factory
{
protected $model = User::class;
public function definition(): array
{
return [
'name' => $this->faker->name(),
'email' => $this->faker->unique()->safeEmail(),
'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password
'remember_token' => Str::random(10),
'timezone' => 'UTC',
];
}
}