I've solved the problem using this:
DB::statement('set @balance := 0');
$entries = Voucher::with('chequeInfo')
->select('receipt_no', 'particular', DB::raw('@balance := @balance + (deposite - expense) as cBal'))
->where('receipt_type', 'LIKE', '%-fund')
->where('ladger_id', $id)->get();
If there is any better way then please post here.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community