Example of Factories in spatie/freek.dev

File database/factories/LinkFactory.php (link to Github)
use App\Models\Link;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;

class LinkFactory extends Factory
{
    public function definition()
    {
        $status = $this->faker->randomElement([
            Link::STATUS_SUBMITTED,
            Link::STATUS_APPROVED,
            Link::STATUS_REJECTED,
        ]);

        return [
            'user_id' => User::factory(),
            'title' => $this->faker->sentence(),
            'url' => $this->faker->url,
            'text' => $this->faker->paragraph,
            'status' => $status,
            'publish_date' => $status === Link::STATUS_APPROVED ? $this->faker->dateTimeBetween('-1 year', 'now') : null,
        ];
    }
}
File database/seeders/LinkSeeder.php (link to Github)
use App\Models\Link;
use Illuminate\Database\Seeder;

class LinkSeeder extends Seeder
{
    public function run()
    {
        Link::factory()->times(50)->create();
    }
}

Additional resources on factories: