RewardPointHistory.php 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. <?php
  2. namespace Longyi\RewardPoints\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. use Webkul\Customer\Models\Customer;
  5. class RewardPointHistory extends Model
  6. {
  7. protected $table = 'mw_reward_point_history';
  8. protected $primaryKey = 'history_id';
  9. public $timestamps = false;
  10. protected $fillable = [
  11. 'customer_id',
  12. 'type_of_transaction',
  13. 'amount',
  14. 'balance',
  15. 'transaction_detail',
  16. 'transaction_time',
  17. 'history_order_id',
  18. 'expired_day',
  19. 'expired_time',
  20. 'point_remaining',
  21. 'check_time',
  22. 'status'
  23. ];
  24. protected $casts = [
  25. 'type_of_transaction' => 'integer',
  26. 'amount' => 'integer',
  27. 'balance' => 'integer',
  28. 'history_order_id' => 'integer',
  29. 'expired_day' => 'integer',
  30. 'point_remaining' => 'integer',
  31. 'check_time' => 'integer',
  32. 'status' => 'integer'
  33. ];
  34. protected $dates = ['transaction_time', 'expired_time'];
  35. const STATUS_PENDING = 0;
  36. const STATUS_COMPLETED = 1;
  37. const STATUS_CANCELLED = 2;
  38. const STATUS_EXPIRED = 3;
  39. public function customer()
  40. {
  41. return $this->belongsTo(Customer::class, 'customer_id');
  42. }
  43. }