mirror of
https://github.com/vitodeploy/vito.git
synced 2025-07-02 14:36:17 +00:00
init
This commit is contained in:
15
database/factories/BackupFactory.php
Normal file
15
database/factories/BackupFactory.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class BackupFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
15
database/factories/BackupFileFactory.php
Normal file
15
database/factories/BackupFileFactory.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class BackupFileFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
23
database/factories/CronJobFactory.php
Normal file
23
database/factories/CronJobFactory.php
Normal 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,
|
||||
];
|
||||
}
|
||||
}
|
20
database/factories/DatabaseFactory.php
Executable file
20
database/factories/DatabaseFactory.php
Executable 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,
|
||||
];
|
||||
}
|
||||
}
|
21
database/factories/DatabaseUserFactory.php
Executable file
21
database/factories/DatabaseUserFactory.php
Executable 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' => '%',
|
||||
];
|
||||
}
|
||||
}
|
18
database/factories/DeploymentFactory.php
Executable file
18
database/factories/DeploymentFactory.php
Executable 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 [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
24
database/factories/DeploymentScriptFactory.php
Normal file
24
database/factories/DeploymentScriptFactory.php
Normal 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(),
|
||||
];
|
||||
}
|
||||
}
|
23
database/factories/FirewallRuleFactory.php
Normal file
23
database/factories/FirewallRuleFactory.php
Normal 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',
|
||||
];
|
||||
}
|
||||
}
|
20
database/factories/NotificationChannelFactory.php
Normal file
20
database/factories/NotificationChannelFactory.php
Normal 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,
|
||||
];
|
||||
}
|
||||
}
|
26
database/factories/QueueFactory.php
Normal file
26
database/factories/QueueFactory.php
Normal 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,
|
||||
];
|
||||
}
|
||||
}
|
25
database/factories/RedirectFactory.php
Normal file
25
database/factories/RedirectFactory.php
Normal 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(),
|
||||
];
|
||||
}
|
||||
}
|
26
database/factories/ScriptExecutionFactory.php
Normal file
26
database/factories/ScriptExecutionFactory.php
Normal 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(),
|
||||
];
|
||||
}
|
||||
}
|
15
database/factories/ScriptFactory.php
Normal file
15
database/factories/ScriptFactory.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class ScriptFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
41
database/factories/ServerFactory.php
Executable file
41
database/factories/ServerFactory.php
Executable 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,
|
||||
];
|
||||
}
|
||||
}
|
21
database/factories/ServerLogFactory.php
Normal file
21
database/factories/ServerLogFactory.php
Normal 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',
|
||||
];
|
||||
}
|
||||
}
|
23
database/factories/ServerProviderFactory.php
Normal file
23
database/factories/ServerProviderFactory.php
Normal 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(),
|
||||
];
|
||||
}
|
||||
}
|
19
database/factories/ServiceFactory.php
Normal file
19
database/factories/ServiceFactory.php
Normal 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 [
|
||||
];
|
||||
}
|
||||
}
|
26
database/factories/SiteFactory.php
Normal file
26
database/factories/SiteFactory.php
Normal 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'
|
||||
];
|
||||
}
|
||||
}
|
20
database/factories/SourceControlFactory.php
Normal file
20
database/factories/SourceControlFactory.php
Normal 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),
|
||||
];
|
||||
}
|
||||
}
|
20
database/factories/SshKeyFactory.php
Normal file
20
database/factories/SshKeyFactory.php
Normal 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',
|
||||
];
|
||||
}
|
||||
}
|
26
database/factories/SslFactory.php
Normal file
26
database/factories/SslFactory.php
Normal 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',
|
||||
];
|
||||
}
|
||||
}
|
15
database/factories/StorageProviderFactory.php
Normal file
15
database/factories/StorageProviderFactory.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class StorageProviderFactory extends Factory
|
||||
{
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
//
|
||||
];
|
||||
}
|
||||
}
|
23
database/factories/UserFactory.php
Executable file
23
database/factories/UserFactory.php
Executable 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',
|
||||
];
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user