Hello Friends,

Welcome To Infinitbility!

after install yajra getting call_user_func_array() expects parameter 1 to be a valid callback, class ‘Yajra\Datatables\Engines\CollectionEngine’ not found laravel issue

Solution 1

Step 1: delete Datatables config file

delete your Datatables config file located on your config/datatables.php

Step 2: publish yajra DataTablesServiceProvider

publish your yajra DataTablesServiceProvider using below cammand

php artisan vendor:publish --provider=Yajra\DataTables\DataTablesServiceProvider

Solution 2

Sometimes issue arive when developer not use ->make(true) after using ->addColumn

Same like below code snipest

public function fetchUsers(){

    # users list
    $Users = User::where('status', 'Y')->get();
    return DataTables::of($Users)
    ->editColumn('created_at', function ($Users)
        $date = date("Y-m-d", strtotime($Users->created_at));
        return $date;

    })->addColumn('update', function ($Users)
        return $return = '<a class="btn btn-primary" href="'. url('admin/update-user').'/'.encrypt($Users->id).'" >Update</a>';
    })->addColumn('delete', function ($Users)
        return $return = '<button data-id="'. encrypt($Users->id) .'" class="btn delete-user btn-danger">Delete</button>';
    })->rawColumns(['update', 'delete'])->make(true);

Thanks For Reading…

More tutorial form Laravel

Yajra issue after install in laravel

Laravel call function from another class

laravel pagination with customization

How to solve page expired error in laravel for webhooks, ajax, and form

Laravel Model

Laravel Clear cache, config, view and Routes

how to force Laravel to use https in URL and assets