0 && Plan::count() > 0) { Plan::each(function ($plan) { User::inRandomOrder() ->first() ->author_of_plans() ->attach($plan->id); }); } } }