isEmpty() || $accounts->isEmpty() || $categories->isEmpty()) { return; } foreach ($accounts->take(5) as $account) { for ($i = 0; $i < 10; $i++) { Transaction::create([ 'user_id' => $users->random()->id, 'account_id' => $account->id, 'category_id' => $categories->random()->id, 'description' => fake()->sentence(), 'description_iv' => fake()->regexify('[A-Za-z0-9]{16}'), 'transaction_date' => fake()->dateTimeBetween('-3 months', 'now'), 'amount' => fake()->randomFloat(2, -500, 500), 'currency_code' => 'USD', 'notes' => fake()->optional(0.3)->paragraph(), 'notes_iv' => fake()->optional(0.3)->regexify('[A-Za-z0-9]{16}'), ]); } } } }