2020-02-06 09:31:43 +00:00
|
|
|
<?php
|
|
|
|
|
2021-06-30 04:00:41 +00:00
|
|
|
namespace Database\Factories;
|
2020-02-06 09:31:43 +00:00
|
|
|
|
2021-06-30 04:00:41 +00:00
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
|
|
|
|
use App\Models\Product;
|
|
|
|
use App\Traits\FactoryActiveTrait;
|
2020-02-06 09:31:43 +00:00
|
|
|
|
2021-06-30 04:00:41 +00:00
|
|
|
class ProductFactory extends Factory
|
|
|
|
{
|
|
|
|
use FactoryActiveTrait;
|
2020-02-18 11:35:20 +00:00
|
|
|
|
2021-06-30 04:00:41 +00:00
|
|
|
/**
|
|
|
|
* The name of the factory's corresponding model.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $model = Product::class;
|
2020-02-18 11:35:20 +00:00
|
|
|
|
2021-06-30 04:00:41 +00:00
|
|
|
/**
|
|
|
|
* Define the model's default state.
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
public function definition()
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'id' => $this->faker->numberBetween(1,65535),
|
2022-04-20 07:05:49 +00:00
|
|
|
// 'created_at',
|
|
|
|
// 'updated_at',
|
2021-06-30 04:00:41 +00:00
|
|
|
//* 'site_id', // Needs to be passed in
|
|
|
|
'taxable' => TRUE,
|
|
|
|
'active' => TRUE,
|
|
|
|
// 'position'
|
2022-02-01 09:15:11 +00:00
|
|
|
'pricing'=>json_encode([
|
|
|
|
[
|
|
|
|
'show'=>true,
|
|
|
|
[
|
|
|
|
'setup'=>50,
|
|
|
|
'base'=>100,
|
2021-06-30 04:00:41 +00:00
|
|
|
]
|
|
|
|
]
|
|
|
|
]),
|
2022-04-20 07:05:49 +00:00
|
|
|
// 'price_recur_default'
|
|
|
|
// 'price_recur_strict'
|
2023-05-05 06:29:08 +00:00
|
|
|
'model_id' => 1,
|
2021-06-30 04:00:41 +00:00
|
|
|
// 'accounting'
|
2023-05-05 06:29:08 +00:00
|
|
|
'model' => Product\Broadband::class,
|
2021-06-30 04:00:41 +00:00
|
|
|
];
|
|
|
|
}
|
2020-02-18 11:35:20 +00:00
|
|
|
|
2021-06-30 04:00:41 +00:00
|
|
|
/* STATES */
|
2020-02-18 11:35:20 +00:00
|
|
|
|
2021-06-30 04:00:41 +00:00
|
|
|
public function notStrict()
|
|
|
|
{
|
|
|
|
return $this->state(function () {
|
|
|
|
return [
|
2022-04-20 07:05:49 +00:00
|
|
|
'price_recur_strict' => FALSE,
|
2021-06-30 04:00:41 +00:00
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
2020-02-18 11:35:20 +00:00
|
|
|
|
2021-06-30 04:00:41 +00:00
|
|
|
public function strict()
|
|
|
|
{
|
|
|
|
return $this->state(function () {
|
|
|
|
return [
|
2022-04-20 07:05:49 +00:00
|
|
|
'price_recur_strict' => TRUE,
|
2021-06-30 04:00:41 +00:00
|
|
|
];
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|