<?php

/** @var \Illuminate\Database\Eloquent\Factory $factory */

use App\Shop;
use Faker\Generator as Faker;

$owner = \App\Owner::query()->whereNotNull('customer_id')->first();
$factory->define(Shop::class, function (Faker $faker)use(&$owner) {
    if (!$owner) $owner = \App\Owner::query()->whereNotNull('customer_id')->first();
    return [
        'name' => $faker->name,
        'owner_id' => $owner ? $owner->id : factory(\App\Owner::class),
    ];
});
