business_id; $units = Unit::where('business_id', $business_id) ->with(['base_unit']) ->get(); return CommonResource::collection($units); } /** * Get the specified unit * * @urlParam unit required comma separated ids of the units Example: 1 * @response { "data": [ { "id": 1, "business_id": 1, "actual_name": "Pieces", "short_name": "Pc(s)", "allow_decimal": 0, "base_unit_id": null, "base_unit_multiplier": null, "created_by": 1, "deleted_at": null, "created_at": "2018-01-03 15:15:20", "updated_at": "2018-01-03 15:15:20", "base_unit": null } ] } */ public function show($unit_ids) { $user = Auth::user(); $business_id = $user->business_id; $unit_ids = explode(',', $unit_ids); $units = Unit::where('business_id', $business_id) ->whereIn('id', $unit_ids) ->with(['base_unit']) ->get(); return CommonResource::collection($units); } }