first(); $factory->define(OwnerReport::class, function (Faker $faker)use($owner) { if (!$owner)$owner = \App\Owner::query()->first(); return [ "owner_id" => $owner ? $owner->id : factory(App\Owner::class), //货主ID "counting_month" => $faker->date(), //结算月 "daily_average_order_amount" => mt_rand(0,10000), //日均单量 "current_month_counting_area" => mt_rand(100,100000) / 50, //结算月盘点面积 "last_month_counting_area" => mt_rand(100,100000) / 50, //结算月上月盘点面积 "owner_bill_report_id" =>factory(App\OwnerBillReport::class), //账单ID "total" => mt_rand(1,2000), ]; });