|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Database\Factories;
|
|
|
|
|
|
|
|
use App\Enums\OrderStatus;
|
|
|
|
use App\Enums\OrderType;
|
|
|
|
use App\Models\Order;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
use Illuminate\Support\Carbon;
|
|
|
|
|
|
|
|
class OrderFactory extends Factory
|
|
|
|
{
|
|
|
|
protected $model = Order::class;
|
|
|
|
|
|
|
|
public function definition(): array
|
|
|
|
{
|
|
|
|
$order_date = Carbon::today()->subDays(rand(0, 30));
|
|
|
|
$due_date = $order_date->copy()->addDays(rand(9, 15));
|
|
|
|
|
|
|
|
return [
|
|
|
|
'created_at' => $order_date,
|
|
|
|
'updated_at' => Carbon::now(),
|
|
|
|
'customer_po' => $this->faker->randomNumber(6, true),
|
|
|
|
'order_type' => $this->faker->randomElement(OrderType::cases())->value,
|
|
|
|
'order_date' => $order_date,
|
|
|
|
'due_date' => $due_date,
|
|
|
|
'status' => $this->faker->randomElement(OrderStatus::cases())->value,
|
|
|
|
'notes' => $this->faker->words(10, true),
|
|
|
|
|
|
|
|
'rush' => $this->faker->boolean(20),
|
|
|
|
'repeat' => $this->faker->boolean(),
|
|
|
|
'new_art' => $this->faker->boolean(),
|
|
|
|
'event' => $this->faker->boolean(),
|
|
|
|
'digitizing' => $this->faker->boolean(),
|
|
|
|
'garments' => $this->faker->boolean(),
|
|
|
|
'supplied_file' => $this->faker->boolean(),
|
|
|
|
|
|
|
|
// 'order_attributes' => ['New Art', 'Garments', 'Rush'],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|