Order.php 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. <?php
  2. namespace ThurData\Servers\KerioEmail\Core\Models\Whmcs;
  3. use \Illuminate\Database\Eloquent\Model as EloquentModel;
  4. /**
  5. * Description of Product
  6. *
  7. * @author Paweł Złamaniec <pawel.zl@thurdata.com>
  8. */
  9. class Order extends EloquentModel
  10. {
  11. /**
  12. * Table name
  13. *
  14. * @var string
  15. */
  16. protected $table = 'tblorders';
  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 = ['ordernum', 'userid', 'contactid', 'date', 'nameservers', 'transfersecret', 'renewals', 'promocode', 'promotype', 'promovalue', 'orderdata', 'amount', 'paymentmethod', 'invoiceid', 'status', 'ipaddress', 'fraudmodule', 'fraudoutput', 'notes'];
  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. public function hostings()
  45. {
  46. return $this->hasMany('ThurData\Servers\KerioEmail\Core\Models\Whmcs\Hosting', 'orderid');
  47. }
  48. public function domains()
  49. {
  50. return $this->hasMany('ThurData\Servers\KerioEmail\Core\Models\Whmcs\Domain', 'orderid');
  51. }
  52. public function addons()
  53. {
  54. return $this->hasMany('ThurData\Servers\KerioEmail\Core\Models\Whmcs\HostingAddon', 'orderid');
  55. }
  56. public function upgrades()
  57. {
  58. return $this->hasMany('ThurData\Servers\KerioEmail\Core\Models\Whmcs\Upgrade', 'orderid');
  59. }
  60. public function invoice()
  61. {
  62. return $this->hasOne('ThurData\Servers\KerioEmail\Core\Models\Whmcs\Invoice', 'id', 'invoiceid');
  63. }
  64. /**
  65. * Get Realted client
  66. */
  67. public function client()
  68. {
  69. return $this->belongsTo('ThurData\Servers\KerioEmail\Core\Models\Whmcs\Client', 'userid');
  70. }
  71. }