Donations Appreciated

We only have what we give. - Isabel Allende

EloquentController.php - Eloquent HasMany

Id Name Email Created At Updated At


    public function getRowDetails()
        return view('datatables.eloquent.row-details');

    public function getRowDetailsData()
        $users = User::select(['id', 'name', 'email', 'created_at', 'updated_at']);

        return Datatables::of($users)->make(true);


    var template = Handlebars.compile($("#details-template").html());

    var table = $('#users-table').DataTable({
        processing: true,
        serverSide: true,
        ajax: '',
        columns: [
                "className":      'details-control',
                "orderable":      false,
                "searchable":     false,
                "data":           null,
                "defaultContent": ''
            {data: 'id', name: 'id'},
            {data: 'name', name: 'name'},
            {data: 'email', name: 'email'},
            {data: 'created_at', name: 'created_at'},
            {data: 'updated_at', name: 'updated_at'}
        order: [[1, 'asc']]

    // Add event listener for opening and closing details
    $('#users-table tbody').on('click', 'td.details-control', function () {
        var tr = $(this).closest('tr');
        var row = table.row( tr );

        if ( row.child.isShown() ) {
            // This row is already open - close it
        else {
            // Open this row
            row.child( template( ).show();

Details Template (using Handlebars)

<script id="details-template" type="text/x-handlebars-template">
    <table class="table">
            <td>Full name:</td>
            <td>Extra info:</td>
            <td>And any further details here (images etc)...</td>