You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
1.2 KiB
PHP
37 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Enums\OrderStatus;
|
|
use App\Models\Customer;
|
|
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));
|
|
|
|
return [
|
|
'created_at' => Carbon::now(),
|
|
'updated_at' => Carbon::now(),
|
|
'internal_po' => 'TN' . $this->faker->randomNumber(4, true),
|
|
'customer_po' => $this->faker->randomNumber(6, true),
|
|
'order_date' => $order_date,
|
|
'due_date' => $order_date->addDays(rand(8, 12)),
|
|
'status' => $this->faker->randomELement(OrderStatus::cases())->value, //todo: setup order status enum
|
|
'rush' => $this->faker->boolean(),
|
|
'new_art' => $this->faker->boolean(),
|
|
'digitizing' => $this->faker->boolean(),
|
|
'repeat' => $this->faker->boolean(),
|
|
'purchased_garments' => $this->faker->boolean(),
|
|
'customer_supplied_file' => $this->faker->boolean(),
|
|
'notes' => $this->faker->words(10, true),
|
|
];
|
|
}
|
|
}
|