Get contact types from setting

This commit is contained in:
Burak Çakırel
2020-01-21 19:47:15 +03:00
parent d66422dfde
commit 25895c82ec
3 changed files with 10 additions and 5 deletions

View File

@ -21,7 +21,9 @@ $factory->define(Bill::class, function (Faker $faker) use ($company) {
$billed_at = $faker->dateTimeBetween(now()->startOfYear(), now()->endOfYear())->format('Y-m-d');
$due_at = Date::parse($billed_at)->addDays(10)->format('Y-m-d');
$contacts = Contact::type('vendor')->enabled()->get();
$types = (string) setting('contact.type.vendor', 'vendor');
$contacts = Contact::type(explode(',', $types))->enabled()->get();
if ($contacts->count()) {
$contact = $contacts->random(1)->first();

View File

@ -21,7 +21,9 @@ $factory->define(Invoice::class, function (Faker $faker) use ($company) {
$invoiced_at = $faker->dateTimeBetween(now()->startOfYear(), now()->endOfYear())->format('Y-m-d');
$due_at = Date::parse($invoiced_at)->addDays(setting('invoice.payment_terms'))->format('Y-m-d');
$contacts = Contact::type('customer')->enabled()->get();
$types = (string) setting('contact.type.customer', 'customer');
$contacts = Contact::type(explode(',', $types))->enabled()->get();
if ($contacts->count()) {
$contact = $contacts->random(1)->first();