Download Laravel-xCRUD Integration Full Code that includes this full demo


<?php

namespace App\Http\Controllers;

use 
Illuminate\Http\Request;

class 
xSubselectController extends Controller
{
    public function 
index()
    {
        
$xcrud Xcrud_get_instance();
        
$xcrud->table('customers');
        
$xcrud->columns('customerName,city,creditLimit,Paid,Profit'); // specify only some columns
        
$xcrud->subselect('Paid','SELECT SUM(amount) FROM payments WHERE customerNumber = {customerNumber}'); // other table
        
$xcrud->subselect('Profit','{Paid}-{creditLimit}'); // current table
        
$xcrud->sum('creditLimit,Paid,Profit'); // sum row(), receives data from full table (ignores pagination)
        
$xcrud->change_type('Profit','price','0',array('prefix'=>'$')); // number format
        
$render $xcrud->render();           
        return 
view('xcrud_simple', ['render' => $render]);
        
    }
}

Customers

#CustomernameCityCreditlimitPaidProfit 
1Atelier graphiqueNantes2100014191.12$-6,808.88 View Edit Remove
2Signal Gift StoresLas Vegas71800150$-71,650.00 View Edit Remove
3Australian Collectors, Co.Melbourne117300134720$17,420.00 View Edit Remove
4La Rochelle GiftsNantes118200116949.687$-1,250.31 View Edit Remove
5Baane Mini ImportsStavern81700104224.79$22,524.79 View Edit Remove
6Mini Gifts Distributors Ltd.San Rafael210500584188.2400000001$373,688.24 View Edit Remove
7Zbyszek Zbyszek PiestrzeniewiczWarszawa1230$0.00 View Edit Remove
8Blauer See Auto, Co.Frankfurt5970075937.76000000001$16,237.76 View Edit Remove
9Mini Wheels Co.San Francisco6460066710.56$2,110.56 View Edit Remove
10Land of Toys Inc.NYC114900107639.94$-7,260.06 View Edit Remove
Σ  8172230.128588124.657000002$417,124.54 
Search