-
- Notifications
You must be signed in to change notification settings - Fork 855
Closed
Description
From version 12.1.1 and after we have encountered an error on sorting on columns without a table prefix. Although the sorting columns are unique between the joined tables the sorting results in error because the prefix is enforced wrongly to the primary table.
Example eloquent query:
$query = Member::select(['members.*', 'qprofiles.id as qprofiles_id', 'qprofiles.active as qprofiles_active', 'qprofiles.date', 'qprofiles.updated_at', 'qprofiles.vision', 'qprofiles.talent', 'qprofiles.competence', 'qprofiles.performance', 'qprofiles.attrition', 'qprofiles.operating', 'qprofiles.profile_role', 'qprofiles.score', 'qprofiles.smart_questions', 'qprofiles.time_in_role', 'qprofiles.reward', 'qprofiles.development_scan', 'qprofiles.organization_design_issue', 'qprofiles.campaign_id', ]) ->with(['department', 'fields']) ->join('departments', 'members.department_id', '=', 'departments.id') ->leftjoin('qprofiles', function ($join) { $join->on('members.id', '=', 'qprofiles.member_id'); $join->on('qprofiles.active', '=', DB::raw('1')); }) ->where('departments.organization_id', Auth::user()->organization_id) ->where('members.active', 1); return DataTables::of($query ) ->addIndexColumn() ->setRowId('id') ...Metadata
Metadata
Assignees
Labels
No labels