Download Laravel-xCRUD Integration Full Code that includes this full demo
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class xNestedController extends Controller
{
public function index()
{
$xcrud = Xcrud_get_instance();
$xcrud->table('orders');
$xcrud->default_tab('Order info');
$xcrud->parsley_active(true);
//Make extension mandatory
$xcrud->set_attr('comments',array('required'=>'required'));
$orderdetails = $xcrud->nested_table('Order details','orderNumber','orderdetails','orderNumber'); // 2nd level
$orderdetails->columns('productCode,quantityOrdered,priceEach');
$orderdetails->fields('productCode,quantityOrdered,priceEach');
$orderdetails->default_tab('Detail information');
$customers = $xcrud->nested_table('Customers','customerNumber','customers','customerNumber'); // 2nd level 2
$customers->columns('customerName,city,country');
$products = $orderdetails->nested_table('Products','productCode','products','productCode'); // 3rd level
$products->default_tab('Product details');
$productLines = $products->nested_table('Product Lines','productLine','productlines','productLine'); // 4th level
$render = $xcrud->render();
return view('xcrud_simple', ['render' => $render]);
}
}
# | Orderdate | Requireddate | Shippeddate | Status | Comments | Customernumber | |
---|---|---|---|---|---|---|---|
1 | 23.10.2003 00:00:00 | 30.10.2003 00:00:00 | Cancelled | Customer called to cancel. The warehouse was | 448 | View Edit Remove | |
2 | 04.11.2003 00:00:00 | 12.11.2003 00:00:00 | 07.11.2003 00:00:00 | Shipped | 452 | View Edit Remove | |
3 | 05.11.2003 00:00:00 | 13.11.2003 00:00:00 | 07.11.2003 00:00:00 | Shipped | 233 | View Edit Remove | |
4 | 05.11.2003 00:00:00 | 14.11.2003 00:00:00 | 11.11.2003 00:00:00 | Shipped | 175 | View Edit Remove | |
5 | 05.11.2003 00:00:00 | 15.11.2003 00:00:00 | 09.11.2003 00:00:00 | Shipped | Cautious optimism. We have happy customers here, | 278 | View Edit Remove |
6 | 06.11.2003 00:00:00 | 15.11.2003 00:00:00 | 10.11.2003 00:00:00 | Shipped | 333 | View Edit Remove | |
7 | 06.11.2003 00:00:00 | 14.11.2003 00:00:00 | 09.11.2003 00:00:00 | Shipped | 324 | View Edit Remove | |
8 | 06.11.2003 00:00:00 | 15.11.2003 00:00:00 | 12.11.2003 00:00:00 | Shipped | 386 | View Edit Remove | |
9 | 07.11.2003 00:00:00 | 17.11.2003 00:00:00 | 12.11.2003 00:00:00 | Shipped | 344 | View Edit Remove | |
10 | 08.11.2003 00:00:00 | 16.11.2003 00:00:00 | 10.11.2003 00:00:00 | Shipped | Custom shipping instructions sent to warehouse | 242 | View Edit Remove |