Kyslik / column-sortable

Package for handling column sorting in Laravel 5/6/7/8
MIT License
641 stars 105 forks source link

How to use sortable inside of a query done inside controller. #197

Open JYvman opened 2 years ago

JYvman commented 2 years ago

Right now, I use a query to display data into a table, so I dont have a model for it. How can I use sortable in this case?

$trainings = Training::sortable()->paginate(8);

    $managers = DB::table('trainingdata')
        ->select('staffName','staff_id','trainer','programTitle','trainingDate','hours','reportingTo')
        ->where('staffName', $username)
        ->orWhere('reportingTo', $username)
        ->get();

    $employees = Training::sortable()
        ->where('staffName', $username)
        ->paginate(8);

$managers is using a query, how do I solve this?

dhanyn10 commented 2 years ago

sorry, are you want to use sortable and search together?