osb/database/factories/ProductFactory.php

78 lines
1.3 KiB
PHP
Raw Normal View History

<?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'
'price_group'=>serialize([
1=>[
0=>[
'price_setup'=>50,
'price_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,
];
});
}
}