Support the ongoing development of Laravel.io →
Database Eloquent

I am taking data from a junction table and want to chunk by id but the method is not recognized. Here is my code:

$dataSet = DB::table('datapoint')
            ->join('datapoint_has_variable', 'datapoint_has_variable.datapointId', '=', 'datapoint.id')
            ->select('datapoint_has_variable.variableId','datapoint_has_variable.datapointId','datapoint_has_variable.value')
            ->where('datapoint.sheetId', $sheet->id)
            ->get();

$dataSet->chunkById('datapointId');

This returns BadMethodCallException - Method chunkById does not exist.

What am I doing wrong?

Last updated 3 years ago.
0
Solution

Collections don't have a chunkById method.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

de6eling de6eling Joined 2 Feb 2017

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2025 Laravel.io - All rights reserved.