first commit
This commit is contained in:
36
database/factories/SourceDatabaseFactory.php
Normal file
36
database/factories/SourceDatabaseFactory.php
Normal file
@@ -0,0 +1,36 @@
|
||||
<?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,
|
||||
]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user