101 lines
2.7 KiB
PHP
101 lines
2.7 KiB
PHP
<?php
|
|
|
|
use Faker\Generator as Faker;
|
|
use Leenooks\Carbon as Carbon;
|
|
|
|
$factory->define(App\Models\InvoiceItem::class, function (Faker $faker) {
|
|
return [
|
|
'id'=>1,
|
|
'price_base'=>100,
|
|
];
|
|
});
|
|
|
|
$factory->afterMaking(App\Models\InvoiceItem::class, function ($item,$faker) {
|
|
$item->exists = TRUE;
|
|
});
|
|
|
|
// Weekly
|
|
$factory->state(App\Models\InvoiceItem::class,'week',[
|
|
'date_start'=>Carbon::now()->startOfWeek(),
|
|
'date_stop'=>Carbon::now()->endOfWeek(),
|
|
'item_type'=>0,
|
|
]);
|
|
|
|
$factory->state(App\Models\InvoiceItem::class,'week-mid',[
|
|
'date_start'=>Carbon::now()->startOfWeek(),
|
|
'date_stop'=>Carbon::now()->endOfWeek()->addDays(3),
|
|
'item_type'=>0,
|
|
]);
|
|
|
|
// Monthly
|
|
$factory->state(App\Models\InvoiceItem::class,'month',[
|
|
'date_start'=>Carbon::now()->startOfMonth(),
|
|
'date_stop'=>Carbon::now()->endOfMonth(),
|
|
'item_type'=>0,
|
|
]);
|
|
|
|
$factory->state(App\Models\InvoiceItem::class,'month-mid',[
|
|
'date_start'=>Carbon::now()->startOfMonth(),
|
|
'date_stop'=>Carbon::now()->endOfMonth()->addDays(Carbon::now()->daysInMonth/2+1),
|
|
'item_type'=>0,
|
|
]);
|
|
|
|
// Quarterly
|
|
$factory->state(App\Models\InvoiceItem::class,'quarter',[
|
|
'date_start'=>Carbon::now()->startOfQuarter(),
|
|
'date_stop'=>Carbon::now()->endOfQuarter(),
|
|
'item_type'=>0,
|
|
]);
|
|
|
|
$factory->state(App\Models\InvoiceItem::class,'quarter-mid',[
|
|
'date_start'=>Carbon::now()->startOfQuarter(),
|
|
'date_stop'=>Carbon::now()->startOfQuarter()->addDays(45),
|
|
'item_type'=>0,
|
|
]);
|
|
|
|
// Half Yearly
|
|
$factory->state(App\Models\InvoiceItem::class,'half',[
|
|
'date_start'=>Carbon::now()->startOfHalf(),
|
|
'date_stop'=>Carbon::now()->endOfHalf(),
|
|
'item_type'=>0,
|
|
]);
|
|
|
|
$factory->state(App\Models\InvoiceItem::class,'half-mid',[
|
|
'date_start'=>Carbon::now()->startOfHalf(),
|
|
'date_stop'=>Carbon::now()->startOfHalf()->addDays(90),
|
|
'item_type'=>0,
|
|
]);
|
|
|
|
// Yearly
|
|
$factory->state(App\Models\InvoiceItem::class,'year',[
|
|
'date_start'=>Carbon::now()->startOfYear(),
|
|
'date_stop'=>Carbon::now()->endOfYear(),
|
|
'item_type'=>0,
|
|
]);
|
|
|
|
$factory->state(App\Models\InvoiceItem::class,'year-mid',[
|
|
'date_start'=>Carbon::now()->startOfYear(),
|
|
'date_stop'=>Carbon::now()->startOfYear()->addDays(181),
|
|
'item_type'=>0,
|
|
]);
|
|
|
|
// Two Yearly (price_recurr_strict ignored)
|
|
$factory->state(App\Models\InvoiceItem::class,'2year',[
|
|
'date_start'=>Carbon::now()->subyear(),
|
|
'date_stop'=>Carbon::now()->subday(),
|
|
'item_type'=>0,
|
|
]);
|
|
|
|
// Three Yearly (price_recurr_strict ignored)
|
|
$factory->state(App\Models\InvoiceItem::class,'3year',[
|
|
'date_start'=>Carbon::now()->subyear(2),
|
|
'date_stop'=>Carbon::now()->subday(),
|
|
'item_type'=>0,
|
|
]);
|
|
|
|
// Last Month
|
|
$factory->state(App\Models\InvoiceItem::class,'next-invoice',[
|
|
'date_start'=>Carbon::now()->startOfMonth(),
|
|
'date_stop'=>Carbon::now()->endOfMonth(),
|
|
'item_type'=>0,
|
|
]); |