Getting 400 bad request while using 'whereIn'
plattarsu opened this issue · comments
I've been getting this error while trying to list the resources from OrderController@index() function. There are no parameters in index function.
$employeeID = array(1,2 );
$controllerAction = 'OrderController@index';
$uri = $this->uriGenerator($controllerAction);
$totalAmount = $this->totalAmountResourceCallable();
$results = function () use ($id) {
return EloquentHelper::paginate(
$this->serializer,
Orders::query()->whereIn('employee_id', $employeeID)
)->get();
};
return $resource->get($totalAmount, $results, $uri, Order::class);
Returned error is
{"errors":[{"status":400,"title":"Bad Request","detail":"Request could not be served."}]}
Is this an issue or I'm missing something?
$employeeID = array();
foreach($user->teams as $team)
{
$employeeID[] = $team->id;
}
This one works
Orders::query()->whereIn('employee_id', [1,2,3]);
This one doesn't
Orders::query()->whereIn('employee_id', $employeeID);