Aronaman
4 months ago
908
8
Laravel

count and sum Db query

Posted 4 months ago by Aronaman

Booking Table

id |org_id | local_id| check_in| Checkout| commision| Pay| Payment_gateway|book_status_id| create_at| update_at|

controller

        $bookedStatus_id=BookStatus::where('name','Booked')->first()->id;
    	$booking=DB::table('bookings')->where('book_status_id',$bookedStatus_id)
			->where('pay','>',0)
								  
			// ->selectRaw("*,SUM(commison) as sum")
			->get()
			->groupBy(['org_id','payment_gateway',function($q){
			return Carbon::parse($q->created_at)->format('d-M-yy');
			}])				  
			->toArray();

my question #1 how to count each each day booking #2 sum each day commison Column

Please sign in or create an account to participate in this conversation.