osb/database/factories/ProductFactory.php
2022-02-02 10:56:28 +11:00

79 lines
1.3 KiB
PHP

<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
use App\Models\Product;
use App\Traits\FactoryActiveTrait;
class ProductFactory extends Factory
{
use FactoryActiveTrait;
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Product::class;
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'id' => $this->faker->numberBetween(1,65535),
//* 'site_id', // Needs to be passed in
// 'date_orig',
// 'date_last',
'taxable' => TRUE,
'active' => TRUE,
// 'position'
// 'group_avail'
// 'avail_category'
// 'price_type'
'pricing'=>json_encode([
[
'show'=>true,
[
'setup'=>50,
'base'=>100,
]
]
]),
// 'price_recurr_default'
// 'price_recurr_day'
// 'price_recurr_weekday'
// 'price_recurr_strict'
// 'prod_plugin_file'
// 'prod_plugin_data' => 1,
// 'accounting'
// 'model' => 'App\Models\Product\Adsl',
];
}
/* STATES */
public function notStrict()
{
return $this->state(function () {
return [
'price_recurr_strict' => FALSE,
];
});
}
public function strict()
{
return $this->state(function () {
return [
'price_recurr_strict' => TRUE,
];
});
}
}