Files
fuel-price/database/factories/StationFactory.php

51 lines
1.9 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\Station;
use Illuminate\Database\Eloquent\Factories\Factory;
/** @extends Factory<Station> */
class StationFactory extends Factory
{
public function definition(): array
{
$trading = $this->faker->company();
return [
'node_id' => hash('sha256', $this->faker->unique()->uuid()),
'trading_name' => $trading,
'brand_name' => $trading,
'is_same_trading_and_brand' => true,
'is_supermarket' => false,
'is_motorway_service_station' => false,
'is_supermarket_service_station' => false,
'temporary_closure' => false,
'permanent_closure' => false,
'permanent_closure_date' => null,
'public_phone_number' => null,
'address_line_1' => $this->faker->streetAddress(),
'address_line_2' => null,
'city' => $this->faker->city(),
'county' => null,
'country' => 'England',
'postcode' => strtoupper($this->faker->postcode()),
'lat' => $this->faker->latitude(49.9, 60.9),
'lng' => $this->faker->longitude(-8.2, 1.8),
'amenities' => [],
'opening_times' => null,
'fuel_types' => ['E10', 'E5'],
'last_seen_at' => now(),
];
}
public function supermarket(): static
{
return $this->state([
'trading_name' => 'Tesco',
'brand_name' => 'Tesco',
'is_supermarket' => true,
]);
}
}