*/ class Client extends EloquentModel { /** * Table name * * @var string */ protected $table = 'tblclients'; protected $primaryKey = 'id'; /** * Eloquent guarded parameters * @var array */ protected $guarded = ['id']; /** * Eloquent fillable parameters * @var array */ protected $fillable = ['uuid', 'firstname', 'lastname', 'companyname', 'email', 'address1', 'address2', 'city', 'state', 'postcode', 'country', 'phonenumber', 'password', 'authmodule', 'authdata', 'currency', 'defaultgateway', 'credit', 'taxexempt', 'latefeeoveride', 'overideduenotices', 'separateinvoices', 'disableautocc', 'datecreated', 'notes', 'billingcid', 'securityqid', 'securityqans', 'groupid', 'cardtype', 'cardlastfour', 'bankname', 'banktype', 'gatewayid', 'lastlogin', 'ip', 'host', 'status', 'language', 'pwresetkey', 'emailoptout', 'overrideautoclose', 'allow_sso', 'email_verified', 'created_at', 'updated_at', 'pwresetexpiry']; /** * Indicates if the model should soft delete. * * @var bool */ protected $softDelete = false; /** * Indicates if the model should be timestamped. * * @var bool */ public $timestamps = false; public function __construct(array $attributes = []) { parent::__construct($attributes); } public function contacts() { return $this->hasMany("ThurData\Servers\KerioEmail\Core\Models\Whmcs\Contact", 'userid'); } public function hostings() { return $this->hasMany("ThurData\Servers\KerioEmail\Core\Models\Whmcs\Hosting", 'userid'); } public function currencyObj() { return $this->hasOne("ThurData\Servers\KerioEmail\Core\Models\Whmcs\Currency", 'id', 'currency'); } public function orders() { return $this->hasMany("ThurData\Servers\KerioEmail\Core\Models\Whmcs\Order", "userid"); } public function transactions() { return $this->hasMany("ThurData\Servers\KerioEmail\Core\Models\Whmcs\Transaction", "userid"); } public function group() { return $this->belongsTo("ThurData\Servers\KerioEmail\Core\Models\Whmcs\ClientGroup", "groupid"); } public function invoices() { return $this->hasMany("ThurData\Servers\KerioEmail\Core\Models\Whmcs\Invoice", "userid"); } public function getFirstnameAttribute() { return preg_replace_callback("/(&#[0-9]+;)/", function ($m) { return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES"); }, html_entity_decode($this->attributes["firstname"])); } public function getLastnameAttribute() { return preg_replace_callback("/(&#[0-9]+;)/", function ($m) { return mb_convert_encoding($m[1], "UTF-8", "HTML-ENTITIES"); }, html_entity_decode($this->attributes["lastname"])); } }