40 lines
936 B
PHP
40 lines
936 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\PlatformInstance;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<PlatformInstance>
|
|
*/
|
|
class PlatformInstanceFactory extends Factory
|
|
{
|
|
protected $model = PlatformInstance::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'platform' => 'lemmy',
|
|
'name' => $this->faker->words(2, true),
|
|
'url' => $this->faker->url(),
|
|
'is_active' => true,
|
|
];
|
|
}
|
|
|
|
public function inactive(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'is_active' => false,
|
|
]);
|
|
}
|
|
|
|
public function lemmy(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'platform' => 'lemmy',
|
|
'name' => 'Lemmy '.$this->faker->word(),
|
|
'url' => 'https://lemmy.'.$this->faker->domainName(),
|
|
]);
|
|
}
|
|
}
|