function search($code) { if (isset($code) && strlen($code) > 1) { $inventoryObject = new Inventory(); $inventoryObject->like('code', $code)->where("status", 1)->get(); foreach ($inventoryObject->all as $inventory) { echo "{$inventory->code}|{$inventory->id}\n"; } } // end if }