File: /home/imensosw/.trash/app/Models/ClientChargeCode.php
<?php
/**
* ClientChargeCodeModel class file
*
* PHP Version 7.2
*
* @category Model
* @package Ez
* @author Imenso Software <admin@imensosoftware.com>
* @license http://imensosoftware/license.php GNU Public License
* @link http://imensosoftware.com/recipes
*/
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* ClientChargeCodeModel class
*
* The class manage ClientChargeCode related queries
*
* @category ClientChargeCodeModel
* @package Ez
* @author Imenso Software <admin@imensosoftware.com>
* @license http://imensosoftware/license.php GNU Public License
* @link http://imensosoftware.com/recipes
*/
class ClientChargeCode extends Model
{
public $table = "client_charge_codes";
public $fillable = ['client_charge_code'];
public $timestamps = false;
/**
* GetClientChargeCode function make a client charge code and
* return the client charge code.
*
* @param int chars
* @param int size
* @param array client charge codes
* @return client charge code array
*/
/*public static function getClientChargeCode($chars, $size, $combinations = array())
{
// if it's the first iteration, the first set
// of combinations is the same as the set of characters
if (empty($combinations)) {
$combinations = $chars;
}
// we're done if we're at size 1
if ($size == 1) {
return $combinations;
}
// initialise array to put new values in
$new_combinations = array();
// loop through existing combinations and character set to create strings
foreach ($combinations as $combination) {
foreach ($chars as $char) {
if ($combination != $char) {
$new_combinations[] = [$combination,$char] ;
}
}
}
// call same function again for the next iteration
return self::getClientChargeCode($chars, $size - 1, $new_combinations);
}*/
}