Files
Verde-Web/database/factories/DumpsiteFactory.php

43 lines
1.3 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\Dumpsite;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
use MatanYadaev\EloquentSpatial\Objects\LineString;
use MatanYadaev\EloquentSpatial\Objects\Point;
use MatanYadaev\EloquentSpatial\Objects\Polygon;
/**
* @extends Factory<Dumpsite>
*/
class DumpsiteFactory extends Factory
{
protected $model = Dumpsite::class;
public function definition(): array
{
$lat = 14.7;
$lng = 121.1;
$half = 0.003;
return [
'uuid' => (string) Str::uuid(),
'name' => fake()->city().' Dumpsite',
'code' => 'DS-'.strtoupper(Str::random(6)),
'address_line' => fake()->streetAddress(),
'coordinates' => new Point($lat, $lng, 4326),
'boundary_polygon' => new Polygon([new LineString([
new Point($lat - $half, $lng - $half, 4326),
new Point($lat - $half, $lng + $half, 4326),
new Point($lat + $half, $lng + $half, 4326),
new Point($lat + $half, $lng - $half, 4326),
new Point($lat - $half, $lng - $half, 4326),
])], 4326),
'capacity_tons' => 1000,
'status' => Dumpsite::STATUS_ACTIVE,
];
}
}