12345678910111213141516171819202122232425262728 |
- <?php
- use Carbon\Carbon;
- use App\Location;
- use Faker\Generator as Faker;
- $factory->define(Location::class, function (Faker $faker) {
- $lat = 36.16310;
- $lng = 49.94950;
- $latArray = [];
- $lngArray = [];
- for ($i=0; $i<10; $i++){
- $latArray[] = $lat;
- $lat += 0.13733;
- $lngArray[] = $lng;
- $lng += 0.00715;
- }
- $time = Carbon::now()->subDays(rand(1, 10))->subHours(rand(8, -8));
- return [
- 'lat' => array_random($latArray),
- 'lng' => array_random($lngArray),
- 'created_at' => $time,
- 'updated_at' => $time,
- 'user_id' => null,//
- ];
- });
|