Hosting.php 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. <?php
  2. namespace ModulesGarden\Servers\ZimbraEmail\Core\Models\Whmcs;
  3. use \Illuminate\Database\Eloquent\Model as EloquentModel;
  4. /**
  5. * Description of Product
  6. *
  7. * @author Paweł Złamaniec <pawel.zl@modulesgarden.com>
  8. */
  9. class Hosting extends EloquentModel
  10. {
  11. /**
  12. * Table name
  13. *
  14. * @var string
  15. */
  16. protected $table = 'tblhosting';
  17. protected $primaryKey = 'id';
  18. /**
  19. * Eloquent guarded parameters
  20. * @var array
  21. */
  22. protected $guarded = ['id'];
  23. /**
  24. * Eloquent fillable parameters
  25. * @var array
  26. */
  27. protected $fillable = ['userid', 'orderid', 'packageid', 'server', 'regdate', 'domain', 'paymentmethod', 'firstpaymentamount', 'amount', 'billingcycle', 'nextduedate', 'nextinvoicedate', 'termination_date', 'completed_date', 'domainstatus', 'username', 'password', 'notes', 'subscriptionid', 'promoid', 'suspendreason', 'overideautosuspend', 'overidesuspenduntil', 'dedicatedip', 'assignedips', 'ns1', 'ns2', 'diskusage', 'disklimit', 'bwusage', 'bwlimit', 'lastupdate'];
  28. /**
  29. * Indicates if the model should soft delete.
  30. *
  31. * @var bool
  32. */
  33. protected $softDelete = false;
  34. /**
  35. * Indicates if the model should be timestamped.
  36. *
  37. * @var bool
  38. */
  39. public $timestamps = false;
  40. public function __construct(array $attributes = [])
  41. {
  42. parent::__construct($attributes);
  43. }
  44. /**
  45. * Get related product
  46. *
  47. * @return type
  48. */
  49. public function product()
  50. {
  51. return $this->belongsTo("ModulesGarden\Servers\ZimbraEmail\Core\Models\Whmcs\Product", "packageid");
  52. }
  53. public function addons()
  54. {
  55. return $this->hasMany("ModulesGarden\Servers\ZimbraEmail\Core\Models\Whmcs\HostingAddon", "hostingid");
  56. }
  57. public function client()
  58. {
  59. return $this->belongsTo("ModulesGarden\Servers\ZimbraEmail\Core\Models\Whmcs\Client", "userid");
  60. }
  61. public function configOptions()
  62. {
  63. return $this->hasMany("ModulesGarden\Servers\ZimbraEmail\Core\Models\Whmcs\HostingConfigOption", "relid");
  64. }
  65. public function server()
  66. {
  67. return $this->belongsTo("ModulesGarden\Servers\ZimbraEmail\Core\Models\Whmcs\Server", "server");
  68. }
  69. public function order()
  70. {
  71. return $this->belongsTo("ModulesGarden\Servers\ZimbraEmail\Core\Models\Whmcs\Order", "orderid");
  72. }
  73. public function cancelation()
  74. {
  75. return $this->hasOne("ModulesGarden\Servers\ZimbraEmail\Core\Models\Whmcs\CancelRequest", "relid");
  76. }
  77. public function getBillingcycleFriendlyAttribute()
  78. {
  79. return $this->attributes['billingcycle'];
  80. }
  81. }