osb/database/factories/InvoiceItemFactory.php

77 lines
2.2 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(),
]);
$factory->state(App\Models\InvoiceItem::class,'week-mid',[
'date_start'=>Carbon::now()->startOfWeek(),
'date_stop'=>Carbon::now()->endOfWeek()->addDays(3),
]);
// Monthly
$factory->state(App\Models\InvoiceItem::class,'month',[
'date_start'=>Carbon::now()->startOfMonth(),
'date_stop'=>Carbon::now()->endOfMonth(),
]);
$factory->state(App\Models\InvoiceItem::class,'month-mid',[
'date_start'=>Carbon::now()->startOfMonth(),
'date_stop'=>Carbon::now()->endOfMonth()->addDays(Carbon::now()->daysInMonth/2+1),
]);
// Quarterly
$factory->state(App\Models\InvoiceItem::class,'quarter',[
'date_start'=>Carbon::now()->startOfQuarter(),
'date_stop'=>Carbon::now()->endOfQuarter(),
]);
$factory->state(App\Models\InvoiceItem::class,'quarter-mid',[
'date_start'=>Carbon::now()->startOfQuarter(),
'date_stop'=>Carbon::now()->startOfQuarter()->addDays(45),
]);
// Half Yearly
$factory->state(App\Models\InvoiceItem::class,'half',[
'date_start'=>Carbon::now()->startOfHalf(),
'date_stop'=>Carbon::now()->endOfHalf(),
]);
$factory->state(App\Models\InvoiceItem::class,'half-mid',[
'date_start'=>Carbon::now()->startOfHalf(),
'date_stop'=>Carbon::now()->startOfHalf()->addDays(90),
]);
// Yearly
$factory->state(App\Models\InvoiceItem::class,'year',[
'date_start'=>Carbon::now()->startOfYear(),
'date_stop'=>Carbon::now()->endOfYear(),
]);
$factory->state(App\Models\InvoiceItem::class,'year-mid',[
'date_start'=>Carbon::now()->startOfYear(),
'date_stop'=>Carbon::now()->startOfYear()->addDays(181),
]);
// Two Yearly (price_recurr_strict ignored)
$factory->state(App\Models\InvoiceItem::class,'2year',[
'date_start'=>Carbon::now()->subyear(),
'date_stop'=>Carbon::now()->subday(),
]);
// Three Yearly (price_recurr_strict ignored)
$factory->state(App\Models\InvoiceItem::class,'3year',[
'date_start'=>Carbon::now()->subyear(2),
'date_stop'=>Carbon::now()->subday(),
]);