-
app/Http/Controllers/Purchases/Vendors.php
Open in GitHubuse App\Abstracts\Http\Controller; use App\Models\Banking\Transaction; class Vendors extends Controller { // public function show(Contact $vendor) { $amounts = [ 'paid' => 0, 'open' => 0, 'overdue' => 0, ]; // $transactions = Transaction::with('account', 'category')->where('contact_id', $vendor->id)->expense()->get(); $counts['transactions'] = $transactions->count(); $transactions->each(function ($item) use (&$amounts) { $amounts['paid'] += $item->getAmountConvertedToDefault(); }); // } // }