32 lines
1.0 KiB
PHP
32 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\User;
|
|
use App\Models\Workspace;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
class WorkspaceFactory extends Factory
|
|
{
|
|
protected $model = Workspace::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
$name = $this->faker->unique()->company();
|
|
return [
|
|
'name' => $name,
|
|
'slug' => Str::slug($name) . '-' . Str::random(4),
|
|
'owner_user_id' => User::factory(),
|
|
'plan' => 'pro',
|
|
'region' => 'eu-central-1',
|
|
'billing_email' => $this->faker->companyEmail(),
|
|
];
|
|
}
|
|
|
|
public function free(): self { return $this->state(['plan' => 'free']); }
|
|
public function starter(): self { return $this->state(['plan' => 'starter']); }
|
|
public function pro(): self { return $this->state(['plan' => 'pro']); }
|
|
public function agency(): self { return $this->state(['plan' => 'agency']); }
|
|
}
|