There is no need for second each inside since you create a single user every iteration of the Collection:
collect([
[
'first_name' => 'Jim',
'last_name' => 'Sanders',
'email' => '[email protected]',
'notification_frequency' => 'instant',
'notification_method' => 'none',
'stripe_id' => null,
'card_brand' => null,
'card_last_four' => null
],
[
'first_name' => 'Michael',
'last_name' => 'Johnson',
'email' => '[email protected]',
'notification_frequency' => 'instant',
// 'notification_mobile' => null,
'stripe_id' => null,
'card_brand' => null,
'card_last_four' => null
]
])->each(function (array $userDetails): void {
$user = factory(App\User::class)->create($userDetails);
$user->isAdmin(true);
});
I expect the problem with every user becoming an admin might be because of the implementation of isAdmin()