osb/database/factories/ProductFactory.php

73 lines
1.2 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),
2022-04-20 07:05:49 +00:00
// 'created_at',
// 'updated_at',
//* '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,
]
]
]),
2022-04-20 07:05:49 +00:00
// 'price_recur_default'
// 'price_recur_strict'
// 'model_id' => 1,
// 'accounting'
// 'model' => 'App\Models\Product\Adsl',
];
}
/* STATES */
public function notStrict()
{
return $this->state(function () {
return [
2022-04-20 07:05:49 +00:00
'price_recur_strict' => FALSE,
];
});
}
public function strict()
{
return $this->state(function () {
return [
2022-04-20 07:05:49 +00:00
'price_recur_strict' => TRUE,
];
});
}
}