use collections

This commit is contained in:
Denis Duliçi
2020-12-31 09:32:00 +03:00
parent 2c3d472cd8
commit 25ea9641ea
5 changed files with 8 additions and 8 deletions

View File

@ -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);
}