osb/database/factories/InvoiceItemFactory.php

96 lines
2.5 KiB
PHP
Raw Normal View History

<?php
use Faker\Generator as Faker;
use Leenooks\Carbon as Carbon;
$factory->define(App\Models\InvoiceItem::class, function (Faker $faker) {
return [
'id'=>1,
];
});
// Weekly
$factory->state(App\Models\InvoiceItem::class,'week',[
'date_start'=>Carbon::now()->startOfWeek(),
'date_stop'=>Carbon::now()->endOfWeek(),
2020-02-12 10:32:57 +00:00
'item_type'=>0,
]);
$factory->state(App\Models\InvoiceItem::class,'week-mid',[
'date_start'=>Carbon::now()->startOfWeek(),
'date_stop'=>Carbon::now()->endOfWeek()->addDays(3),
2020-02-12 10:32:57 +00:00
'item_type'=>0,
]);
// Monthly
$factory->state(App\Models\InvoiceItem::class,'month',[
'date_start'=>Carbon::now()->startOfMonth(),
'date_stop'=>Carbon::now()->endOfMonth(),
2020-02-12 10:32:57 +00:00
'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),
2020-02-12 10:32:57 +00:00
'item_type'=>0,
]);
// Quarterly
$factory->state(App\Models\InvoiceItem::class,'quarter',[
'date_start'=>Carbon::now()->startOfQuarter(),
'date_stop'=>Carbon::now()->endOfQuarter(),
2020-02-12 10:32:57 +00:00
'item_type'=>0,
]);
$factory->state(App\Models\InvoiceItem::class,'quarter-mid',[
'date_start'=>Carbon::now()->startOfQuarter(),
'date_stop'=>Carbon::now()->startOfQuarter()->addDays(45),
2020-02-12 10:32:57 +00:00
'item_type'=>0,
]);
// Half Yearly
$factory->state(App\Models\InvoiceItem::class,'half',[
'date_start'=>Carbon::now()->startOfHalf(),
'date_stop'=>Carbon::now()->endOfHalf(),
2020-02-12 10:32:57 +00:00
'item_type'=>0,
]);
$factory->state(App\Models\InvoiceItem::class,'half-mid',[
'date_start'=>Carbon::now()->startOfHalf(),
'date_stop'=>Carbon::now()->startOfHalf()->addDays(90),
2020-02-12 10:32:57 +00:00
'item_type'=>0,
]);
// Yearly
$factory->state(App\Models\InvoiceItem::class,'year',[
'date_start'=>Carbon::now()->startOfYear(),
'date_stop'=>Carbon::now()->endOfYear(),
2020-02-12 10:32:57 +00:00
'item_type'=>0,
]);
$factory->state(App\Models\InvoiceItem::class,'year-mid',[
'date_start'=>Carbon::now()->startOfYear(),
'date_stop'=>Carbon::now()->startOfYear()->addDays(181),
2020-02-12 10:32:57 +00:00
'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(),
2020-02-12 10:32:57 +00:00
'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(),
2020-02-12 10:32:57 +00:00
'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,
]);