30 lines
679 B
PHP
30 lines
679 B
PHP
<?php
|
|||
|
|
|
||
|
|
namespace Database\Factories;
|
||
|
|
|
||
|
|
use App\Models\User;
|
||
|
|
use App\Models\Website;
|
||
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||
|
|
use Illuminate\Support\Str;
|
||
|
|
|
||
|
|
/** @extends Factory<Website> */
|
||
|
|
class WebsiteFactory extends Factory
|
||
|
|
{
|
||
|
|
public function definition(): array
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'user_id' => User::factory(),
|
||
|
|
'name' => fake()->company(),
|
||
|
|
'domain' => fake()->domainName(),
|
||
|
|
'tracking_id' => 'TA-'.strtoupper(Str::random(10)),
|
||
|
|
'is_active' => true,
|
||
|
|
'settings' => [],
|
||
|
|
];
|
||
|
|
}
|
||
|
|
|
||
|
|
public function inactive(): static
|
||
|
|
{
|
||
|
|
return $this->state(['is_active' => false]);
|
||
|
|
}
|
||
|
|
}
|