<commit_before><?php

use Illuminate\Database\Seeder;
use Faker\Factory;
use Carbon\Carbon;
use App\Shop;
use App\Position;

class ShopsTableSeeder extends Seeder
{
    private $locations = [];
    private $index = 0;

    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        // Generate Faker
        $faker = Factory::create(config('app.locale'));

        // Init Location
        $this->initLocation();

        // Create Shop
        for ($i = 0; $i < 20; $i++) {
            $shop = Shop::create([
                'name'        => $faker->company,
                'description' => $faker->optional()->catchPhrase,
                'url'         => $faker->optional()->url,
                'tel'         => $faker->optional()->phoneNumber,
                'open_at'     => Carbon::createFromFormat('H:i', $faker->time('H:i')),
                'close_at'    => Carbon::createFromFormat('H:i', $faker->time('H:i')),
            ]);

            // Decide how many position (0~3) belongs to this shop
            $positionAmount = random_int(0, 3);

            // Create positions (0~3)
            for ($j = 0; $j < $positionAmount; $j++) {
                $location = $this->getLocation();
                Position::create([
                    'shop_id'     => $shop->id,
                    'description' => mb_substr($faker->realText(10, 2), 0, 2) . '店',
                    'address'     => $location['address'],
                    'longitude'   => $location['lng'],
                    'latitude'    => $location['lat'],
                ]);
            }
        }
    }

    private function initLocation()
    {
        // Read location file generate by other faker<commit_msg>Update seeder for more testing data<commit_after><?php

use Illuminate\Database\Seeder;
use Faker\Factory;
use Carbon\Carbon;
use App\Shop;
use App\Position;

class ShopsTableSeeder extends Seeder
{
    private $locations = [];
    private $index = 0;

    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        // Generate Faker
        $faker = Factory::create(config('app.locale'));

        // Init Location
        $this->initLocation();

        // Create Shop
        for ($i = 0; $i < 200; $i++) {
            $shop = Shop::create([
                'name'        => $faker->company,
                'description' => $faker->optional()->catchPhrase,
                'url'         => $faker->optional()->url,
                'tel'         => $faker->optional()->phoneNumber,
                'open_at'     => Carbon::createFromFormat('H:i', $faker->time('H:i')),
                'close_at'    => Carbon::createFromFormat('H:i', $faker->time('H:i')),
            ]);

            // Decide how many position (0~3) belongs to this shop
            $positionAmount = random_int(0, 3);

            // Create positions (0~3)
            for ($j = 0; $j < $positionAmount; $j++) {
                $location = $this->getLocation();
                Position::create([
                    'shop_id'     => $shop->id,
                    'description' => mb_substr($faker->realText(10, 2), 0, 2) . '店',
                    'address'     => $location['address'],
                    'longitude'   => $location['lng'],
                    'latitude'    => $location['lat'],
                ]);
            }
        }
    }

    private function initLocation()
    {
        // Read location file generate by other faker
{'fraction_non_alphanumeric': 0.15761024182076813, 'fraction_numerical': 0.009388335704125178, 'mean_word_length': 1.5664233576642337, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 51, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '229720', 'n_tokens_mistral': 1048, 'n_tokens_neox': 988, 'n_words': 220}