37 lines
1006 B
PHP
37 lines
1006 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\SourceDatabase;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\SourceDatabase>
|
|
*/
|
|
class SourceDatabaseFactory extends Factory
|
|
{
|
|
protected $model = SourceDatabase::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'name' => fake()->unique()->company() . ' DB',
|
|
'host' => fake()->randomElement(['localhost', '127.0.0.1', 'db.example.com']),
|
|
'port' => 5432,
|
|
'database' => fake()->unique()->word() . '_db',
|
|
'username' => fake()->userName(),
|
|
'password' => fake()->password(16),
|
|
'driver' => 'pgsql',
|
|
'description' => fake()->optional()->sentence(),
|
|
'is_active' => true,
|
|
];
|
|
}
|
|
|
|
public function inactive(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'is_active' => false,
|
|
]);
|
|
}
|
|
}
|