Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

PaulCatalin97's avatar

Call to a member function sortable() on array

so i have this table to show datas from 3 tables joined, how can i use sortable in this situation? $candidat = DB::SELECT('select p.id, p.first_name, p.last_name, p.phone, p.cv , j.id, j.titlu , jp.id, jp.id_job, jp.id_profile, jp.created_at, jp.created_at as data_aplicare, se.name as skill, j.id_skill as aptitudine_necesara from job_to_profile jp inner join joburi j on j.id = jp.id_job inner join profile_employee p on p.id = jp.id_profile inner join skill_toprofile sp on sp.id_profile = p.id inner join skills_employee se on se.id = sp.id_skill')->sortable()->paginate(15);

0 likes
2 replies
tykus's avatar

What is sortable()?

Otherwise, the result of DB::select is an array, not a Builder instance (if that is what you were expecting). You can get a Builder instance using the form:

DB::table('job_to_profile as jp')
    ->selectRaw('p.id, p.first_name, p.last_name, p.phone, p.cv , j.id, j.titlu , jp.id, jp.id_job, jp.id_profile, jp.created_at, jp.created_at as data_aplicare, se.name as skill, j.id_skill as aptitudine_necesara')
    ->join(...)
//  other Builder methods
    ->get();
Snapey's avatar

The docs;

Use Sortable trait inside your Eloquent model(s).

You are not using Eloquent models.

Please or to participate in this conversation.