public static function createClient($data = array()) { if (count($data) <= 0) { return; } $clientID = 0; $ClientExist = array(); // -- Check to see if the client exists // ------------------------------------ $ClientExist = self::duplicateCheck($data); if (count($ClientExist) > 0) { $clientID = $ClientExist->clientID; } else { // -- Client not found, so create the client // ----------------------------------------- $clientID = \ClientModel::createClient($data); } if ($clientID > 0) { // -- Create a product for the client // ---------------------------------- $data['client_id'] = $clientID; $clientProductID = \ClientModel::createClientProduct($data); } // -- Create a Client from a selected Referral Lead // ------------------------------------------------ if ($clientID > 0 && $clientProductID > 0) { return $clientID; } else { return 0; } }