1234567891011121314151617181920212223242526272829 |
- <?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' => Carbon::now()->subDays(rand(1, 10))->subHours(rand(8, -8)),
- 'created_at' => $time,
- 'updated_at' => $time,
- 'user_id' => null,//
- ];
- });
|