You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
pixelfed/database/factories/ProfileFactory.php

46 lines
1.1 KiB
PHP

<?php
namespace Database\Factories;
use App\Profile;
use App\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class ProfileFactory extends Factory
{
protected $model = Profile::class;
public function definition(): array
{
return [
'user_id' => User::factory(),
'username' => str_replace('.', '', fake()->unique()->userName()),
'name' => fake()->name(),
'domain' => null,
'remote_url' => null,
'is_private' => false,
'status_count' => 0,
'following_count' => 0,
'followers_count' => 0,
'last_fetched_at' => null,
'last_status_at' => null,
];
}
public function private(): static
{
return $this->state(fn (array $attributes) => [
'is_private' => true,
]);
}
public function remote(): static
{
return $this->state(fn (array $attributes) => [
'domain' => fake()->domainName(),
'remote_url' => fake()->url(),
'user_id' => null,
]);
}
}