Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
how do I distinguish the status of a transaction, if in my code now it only shows the total transaction, but not the status of each transaction, for example there are 10 transactions, now in 10 there are successful transactions 4 failed 4 cancel 4

What I have tried:

DB::table('covis_transactions as a')
->leftJoin('covis_customers as b', 'a.covis_customer_id','b.id')
->leftJoin('companies as c', 'b.company_id', 'c.id')
->leftJoin('projects as d', 'b.project_id', 'd.id')
->leftJoin('branchs as e', 'b.branch_id', 'e.id')
->leftJoin('regions as f', 'b.region_id', 'f.id')
->whereBetween('a.visited_at', [$from, $to])
->where('e.is_active', 1)
->select(
'a.status as status',
'b.name as customer_name',
'e.name as branch_name',
'c.name as company_name',
'd.name as project_name',
'f.name as region_name',
'e.code as branch_code',
'e.id as branch_id',
DB::raw('COUNT(a.id) as total_transaksi'),
)
->groupBy(
'branch_id',
'customer_name',
'branch_name',
'branch_code',
'status',
'company_name',
'project_name',
'region_name',
)
->get();
Posted
Updated 29-May-22 21:36pm
v2
Comments
jijomp12 28-Jul-22 3:14am    
Your question is not clear

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900