use collections
This commit is contained in:
@ -150,13 +150,13 @@ class Payments extends Controller
|
||||
|
||||
$vendors = Contact::vendor()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
|
||||
|
||||
if ($payment->contact && !array_key_exists($payment->contact_id, $vendors)) {
|
||||
if ($payment->contact && !$vendors->has($payment->contact_id)) {
|
||||
$vendors->put($payment->contact->id, $payment->contact->name);
|
||||
}
|
||||
|
||||
$categories = Category::expense()->enabled()->orderBy('name')->take(setting('default.select_limit'))->pluck('name', 'id');
|
||||
|
||||
if ($payment->category && !array_key_exists($payment->category_id, $categories)) {
|
||||
if ($payment->category && !$categories->has($payment->category_id)) {
|
||||
$categories->put($payment->category->id, $payment->category->name);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user