37 lines
936 B
PHP
37 lines
936 B
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\DropOffPoint;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
use MatanYadaev\EloquentSpatial\Objects\Point;
|
|
|
|
/**
|
|
* @extends Factory<DropOffPoint>
|
|
*/
|
|
class DropOffPointFactory extends Factory
|
|
{
|
|
protected $model = DropOffPoint::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'uuid' => (string) Str::uuid(),
|
|
'name' => fake()->company().' DOP',
|
|
'code' => 'DOP-'.strtoupper(Str::random(6)),
|
|
'coordinates' => new Point(14.6, 121.0, 4326),
|
|
'address_line' => fake()->streetAddress(),
|
|
'capacity_kg' => 1000,
|
|
'status' => DropOffPoint::STATUS_ACTIVE,
|
|
];
|
|
}
|
|
|
|
public function at(float $lat, float $lng): static
|
|
{
|
|
return $this->state(fn () => [
|
|
'coordinates' => new Point($lat, $lng, 4326),
|
|
]);
|
|
}
|
|
}
|