osb/database/factories/AdslPlanFactory.php

86 lines
2.0 KiB
PHP
Raw Permalink Normal View History

<?php
use Faker\Generator as Faker;
$factory->define(App\Models\Product\Adsl::class, function (Faker $faker) {
return [
'id'=>1,
'contract_term'=>12,
];
});
$factory->afterMaking(App\Models\Product\Adsl::class, function ($adsl,$faker) {
$product = factory(App\Models\AdslSupplierPlan::class)->make();
$adsl->setRelation('product',$product);
$adsl->adsl_supplier_plan_id = $product->id;
});
$factory->state(App\Models\Product\Adsl::class,'unlimit',[
'base_down_peak'=>NULL,
'base_up_peak'=>NULL,
'base_down_offpeak'=>NULL,
'base_up_offpeak'=>NULL,
'extra_charged'=>NULL,
'extra_shaped'=>NULL,
'extra_down_peak'=>NULL,
'extra_up_peak'=>NULL,
'extra_down_offpeak'=>NULL,
'extra_up_offpeak'=>NULL,
'metric'=>1,
]);
$factory->state(App\Models\Product\Adsl::class,'140/0/0/0',[
'base_down_peak'=>140,
'base_up_peak'=>0,
'base_down_offpeak'=>0,
'base_up_offpeak'=>0,
'extra_charged'=>NULL,
'extra_shaped'=>NULL,
'extra_down_peak'=>1,
'extra_up_peak'=>NULL,
'extra_down_offpeak'=>NULL,
'extra_up_offpeak'=>NULL,
'metric'=>1,
]);
$factory->state(App\Models\Product\Adsl::class,'70/-/0/-',[
'base_down_peak'=>70,
'base_up_peak'=>NULL,
'base_down_offpeak'=>0,
'base_up_offpeak'=>NULL,
'extra_charged'=>NULL,
'extra_shaped'=>NULL,
'extra_down_peak'=>1,
'extra_up_peak'=>NULL,
'extra_down_offpeak'=>NULL,
'extra_up_offpeak'=>NULL,
'metric'=>1,
]);
$factory->state(App\Models\Product\Adsl::class,'100/0/40/0',[
'base_down_peak'=>100,
'base_up_peak'=>0,
'base_down_offpeak'=>40,
'base_up_offpeak'=>0,
'extra_charged'=>NULL,
'extra_shaped'=>NULL,
'extra_down_peak'=>0,
'extra_up_peak'=>NULL,
'extra_down_offpeak'=>0,
'extra_up_offpeak'=>NULL,
'metric'=>1,
]);
$factory->state(App\Models\Product\Adsl::class,'50/-/20/-',[
'base_down_peak'=>50,
'base_up_peak'=>NULL,
'base_down_offpeak'=>20,
'base_up_offpeak'=>NULL,
'extra_charged'=>NULL,
'extra_shaped'=>NULL,
'extra_down_peak'=>0,
'extra_up_peak'=>NULL,
'extra_down_offpeak'=>0,
'extra_up_offpeak'=>NULL,
'metric'=>1,
]);