Get contact types from setting
This commit is contained in:
parent
d66422dfde
commit
25895c82ec
@ -8,6 +8,7 @@ use App\Models\Common\Contact;
|
||||
use App\Models\Sale\Invoice;
|
||||
use App\Models\Setting\Category;
|
||||
use App\Models\Setting\Currency;
|
||||
use App\Traits\Contacts;
|
||||
use App\Traits\Currencies;
|
||||
use App\Traits\DateTime;
|
||||
use App\Traits\Sales;
|
||||
@ -17,7 +18,7 @@ use Illuminate\Support\Facades\URL;
|
||||
|
||||
class Invoices extends Controller
|
||||
{
|
||||
use DateTime, Currencies, Sales, Uploads;
|
||||
use DateTime, Currencies, Sales, Uploads, Contacts;
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
@ -52,7 +53,7 @@ class Invoices extends Controller
|
||||
|
||||
$account_currency_code = Account::where('id', setting('default.account'))->pluck('currency_code')->first();
|
||||
|
||||
$customers = Contact::type('customer')->enabled()->orderBy('name')->pluck('name', 'id');
|
||||
$customers = Contact::type($this->getCustomerTypes())->enabled()->orderBy('name')->pluck('name', 'id');
|
||||
|
||||
$categories = Category::type('income')->enabled()->orderBy('name')->pluck('name', 'id');
|
||||
|
||||
@ -156,7 +157,7 @@ class Invoices extends Controller
|
||||
|
||||
$account_currency_code = Account::where('id', setting('default.account'))->pluck('currency_code')->first();
|
||||
|
||||
$customers = Contact::type('customer')->enabled()->pluck('name', 'id');
|
||||
$customers = Contact::type($this->getCustomerTypes())->enabled()->pluck('name', 'id');
|
||||
|
||||
$categories = Category::type('income')->enabled()->pluck('name', 'id');
|
||||
|
||||
|
@ -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();
|
||||
|
@ -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();
|
||||
|
Loading…
x
Reference in New Issue
Block a user