Implement dark mode, bug report page, and schema dump
This commit is contained in:
38
database/factories/BudgetItemFactory.php
Normal file
38
database/factories/BudgetItemFactory.php
Normal file
@@ -0,0 +1,38 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Budget;
|
||||
use App\Models\BudgetItem;
|
||||
use App\Models\ChartOfAccount;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class BudgetItemFactory extends Factory
|
||||
{
|
||||
protected $model = BudgetItem::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
$account = ChartOfAccount::first();
|
||||
|
||||
if (! $account) {
|
||||
$account = ChartOfAccount::create([
|
||||
'account_code' => $this->faker->unique()->numerify('4###'),
|
||||
'account_name_zh' => '測試費用',
|
||||
'account_name_en' => 'Test Expense',
|
||||
'account_type' => 'expense',
|
||||
'category' => 'operating',
|
||||
'is_active' => true,
|
||||
'display_order' => 1,
|
||||
]);
|
||||
}
|
||||
|
||||
return [
|
||||
'budget_id' => Budget::factory(),
|
||||
'chart_of_account_id' => $account->id,
|
||||
'budgeted_amount' => $this->faker->numberBetween(1000, 5000),
|
||||
'actual_amount' => $this->faker->numberBetween(0, 4000),
|
||||
'notes' => $this->faker->sentence(),
|
||||
];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user