45 lines
1.3 KiB
PHP
45 lines
1.3 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\OutletStatus;
|
|
use App\Models\Outlet;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
class OutletFactory extends Factory
|
|
{
|
|
protected $model = Outlet::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'name' => $this->faker->company(),
|
|
'phone_number' => $this->faker->randomElement([
|
|
$this->faker->numerify('0812 #### ###'),
|
|
$this->faker->numerify('0812 #### ####'),
|
|
$this->faker->numerify('0812 #### #####'),
|
|
]),
|
|
'address' => $this->faker->address(),
|
|
'landmark' => $this->faker->streetName(),
|
|
'maps_url' => 'https://goo.gl/maps/'.$this->faker->regexify('[A-Za-z0-9]{6,10}'),
|
|
'opened_date' => $this->faker->date(),
|
|
'status' => $this->faker->randomElement(OutletStatus::cases()),
|
|
];
|
|
}
|
|
|
|
public function operational(): Factory
|
|
{
|
|
return $this->state(fn () => ['status' => OutletStatus::OPERATIONAL]);
|
|
}
|
|
|
|
public function underConstruction(): Factory
|
|
{
|
|
return $this->state(fn () => ['status' => OutletStatus::UNDER_CONSTRUCTION]);
|
|
}
|
|
|
|
public function terminated(): Factory
|
|
{
|
|
return $this->state(fn () => ['status' => OutletStatus::TERMINATED]);
|
|
}
|
|
}
|