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 
1Signal Gift StoresLas Vegas71800$0.00 View Edit Remove
2Australian Collectors, Co.343434Melbourne117300334$0.00 View Edit Remove
3La Rochelle Gifts mzgsNantes118200$0.00 View Edit Remove
4Baane Mini ImportsStavern81700$0.00 View Edit Remove
5Mini Gifts Distributors Ltd.San Rafael210500$0.00 View Edit Remove
6Zbyszek Zbyszek PiestrzeniewiczWarszawa1230$0.00 View Edit Remove
7Blauer See Auto, Co.Frankfurt59700$0.00 View Edit Remove
8Mini Wheels Co.San Francisco64600$0.00 View Edit Remove
9Land of Toys Inc.NYC114900$0.00 View Edit Remove
10Euro+ Shopping ChannelMadrid22760024625124284.39$24,624,896,684.39 View Edit Remove
Σ  125417664.1224631781137.2534$24,624,386,437.13 
Search