this repo has no description
at master 37 lines 1.0 kB view raw
1<?php 2 3namespace Database\Factories; 4 5use App\Models\Account; 6use Illuminate\Database\Eloquent\Factories\Factory; 7use Illuminate\Support\Str; 8 9/** 10 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Transaction> 11 */ 12class TransactionFactory extends Factory 13{ 14 /** 15 * Define the model's default state. 16 * 17 * @return array<string, mixed> 18 */ 19 public function definition(): array 20 { 21 $account = fake()->randomElement(Account::all()); 22 23 return [ 24 "account_id" => $account->id, 25 "external_ref" => Str::random(10), 26 "posted_at" => fake()->date(), 27 "authorized_at" => null, 28 "description" => fake()->text(), 29 "amount_minor" => fake()->randomNumber(5), 30 "currency" => $account->currency, 31 "direction" => fake()->randomElement(["debit", "credit"]), 32 "status" => "posted", 33 "counterpart_id" => null, 34 "raw_json" => null, 35 ]; 36 } 37}