fix wallets transaction lists

This commit is contained in:
omair saleh
2022-02-28 11:21:18 +08:00
parent fdf8711a01
commit 280ea6bdac
2 changed files with 2 additions and 2 deletions
+2 -1
View File
@@ -15,6 +15,7 @@ use App\Models\SegmentConstant;
use Carbon\Carbon;
use Illuminate\Http\Resources\Json\JsonResource;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Log;
class CompanyResource extends JsonResource
{
@@ -28,7 +29,7 @@ class CompanyResource extends JsonResource
{
$lastPayment = $this->transactions()->where('transactions.type', TransactionType::PAYMENT)->whereIn('transactions.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->orderBy('id', 'DESC')->first();
$totalPayments = $this->transactions()->where('transactions.type', TransactionType::PAYMENT)->whereIn('transactions.status', [ApprovalStatus::APPROVED, ApprovalStatus::COMPLETED])->sum('amount');
Log::info($this->wallets()->first()->code);
return [
'id' => $this->id,
'name' => $this->name,