allowedSorts(['id', 'name', 'weight', 'type', 'created_at', 'updated_at']); if ($request->has('limit')) { $role = $query->paginate($request->query('limit')); } else { $role = $query->paginate(); } $role->getCollection()->transform(function ($roles) { return $roles; }); return CriteriaResource::collection($role); } }