osb/database/factories/ServiceFactory.php
2023-05-09 10:09:00 +09:00

70 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),
// 'created_at',
// 'updated_at',
//* 'site_id', // Needs to be passed in
//* 'account_id'
// 'account_billing_id'
// 'product_id' =
'active' => TRUE,
'suspend_billing' => FALSE,
'external_billing' => FALSE,
'price' => 100,
// 'taxable',
// 'queue',
'invoice_last_at' => Carbon::createFromFormat('Y-m-d','2021-01-01'),
// 'invoice_next_at',
// 'recur_schedule',
// 'prod_attr',
// 'start_at',
// 'stop_at',
// 'ordered_by',
// 'order_status',
// 'order_info',
'model' => Service\Broadband::class,
];
}
}