You've already forked Atomcms-edit
36 lines
819 B
PHP
Executable File
36 lines
819 B
PHP
Executable File
<?php
|
|
|
|
namespace Database\Factories\User;
|
|
|
|
use App\Models\User;
|
|
use App\Models\User\UserOrder;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
class UserOrderFactory extends Factory
|
|
{
|
|
protected $model = UserOrder::class;
|
|
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'user_id' => User::factory(),
|
|
'status' => UserOrder::STATUS_PENDING,
|
|
'amount' => $this->faker->numberBetween(100, 50000),
|
|
];
|
|
}
|
|
|
|
public function completed(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'status' => UserOrder::STATUS_COMPLETED,
|
|
]);
|
|
}
|
|
|
|
public function cancelled(): static
|
|
{
|
|
return $this->state(fn (array $attributes) => [
|
|
'status' => UserOrder::STATUS_CANCELLED,
|
|
]);
|
|
}
|
|
}
|