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

72 lines
1.5 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\Service;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\Factory;
class ServiceFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Service::class;
public function configure()
{
return $this->afterMaking(function (Service $service) {
/*
$product = factory(App\Models\Product::class)->make();
$service->setRelation('product',$product);
$service->product_id = $product->id;
$account = factory(App\Models\Account::class)->make();
$service->setRelation('account',$account);
$service->account_id = $account->id;
*/
})->afterCreating(function (Service $service) {
//
});
}
/**
* Define the model's default state.
*
* @return array
*/
public function definition()
{
return [
'id' => $this->faker->numberBetween(1,65535),
// 'date_orig',
// 'date_last',
//* 'site_id', // Needs to be passed in
//* 'account_id'
// 'account_billing_id'
// 'product_id' =
'active' => TRUE,
'suspend_billing' => FALSE,
'external_billing' => FALSE,
'price' => 100,
'price_group' => 1,
// 'price_override',
// 'taxable',
// 'queue',
'date_last_invoice' => Carbon::createFromFormat('Y-m-d','2021-01-01'),
// 'date_next_invoice',
// 'recur_schedule',
// 'prod_attr',
// 'date_start',
// 'date_end',
// 'orderedby_id',
// 'order_status',
// 'order_info',
'model' => 'App\Models\Service\Broadband',
];
}
}