Donations Appreciated

It's not how much we give but how much love we put into giving. - Mother Teresa

Click here to lend your support to: Laravel Datatables and make a donation at !

FluentController.php - Overriding Global Search

Custom Filter

Id Name Email Created At Updated At


    public function getCustomFilter()
        return view('datatables.fluent.custom-filter');

    public function getCustomFilterData(Request $request)
        $users = DB::table('users')->select(['id', 'name', 'email', 'created_at', 'updated_at']);

        return Datatables::of($users)
            ->filter(function ($query) use ($request) {
                if ($request->has('name')) {
                    $query->where('name', 'like', "%{$request->get('name')}%");

                if ($request->has('email')) {
                    $query->where('email', 'like', "%{$request->get('email')}%");


    var oTable = $('#users-table').DataTable({
        dom: "<'row'<'col-xs-12'<'col-xs-6'l><'col-xs-6'p>>r>"+
        processing: true,
        serverSide: true,
        ajax: {
            url: '',
            data: function (d) {
       = $('input[name=name]').val();
       = $('input[name=email]').val();
        columns: [
            {data: 'id', name: 'id'},
            {data: 'name', name: 'name'},
            {data: 'email', name: 'email'},
            {data: 'created_at', name: 'created_at'},
            {data: 'updated_at', name: 'updated_at'}

    $('#search-form').on('submit', function(e) {