dstpabuaran.com/database/factories/OrderFactory.php
Yoga Pangestu 72848d51d8 feat: add transaction management page with filtering and CRUD functionality
- Implemented TransactionIndex component for displaying transactions with pagination and filtering options.
- Created TransactionCardRow component for rendering individual transaction details.
- Added TransactionItemSubRow component for displaying detailed order items within a transaction.
- Integrated delete confirmation dialog for transaction deletion.
- Updated routes to include transaction management with appropriate permissions.
2026-08-04 10:37:28 +07:00

32 lines
1.0 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\Customer;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
class OrderFactory extends Factory
{
public function definition(): array
{
$subtotal = fake()->numberBetween(10000, 1000000);
$discount = fake()->numberBetween(0, $subtotal);
return [
'customer_id' => Customer::factory(),
'created_by_id' => User::factory(),
'order_number' => fake()->unique()->numerify('ORD-####'),
'channel' => fake()->randomElement(['store', 'shopee', 'tiktok']),
'price_type' => fake()->randomElement(['retail', 'wholesale']),
'status' => 'pending',
'payment_type' => fake()->randomElement(['cash', 'transfer', 'marketplace', 'qris']),
'is_affiliate' => false,
'subtotal' => $subtotal,
'discount' => $discount,
'total_amount' => $subtotal - $discount,
'notes' => fake()->sentence(),
];
}
}