CardRiding.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. namespace App\Models;
  3. class CardRiding extends Model
  4. {
  5. protected $table = 'card_riding';
  6. const LIMIT_TIMES_YES = 1;
  7. const LIMIT_TIMES_NO = 0;
  8. public static $limitTimesMaps = [
  9. self::LIMIT_TIMES_NO => '不限次',
  10. self::LIMIT_TIMES_YES => '限次',
  11. ];
  12. const DISCOUNT_YES = 1;
  13. const DISCOUNT_NO = 0;
  14. public static $discountMaps = [
  15. self::DISCOUNT_NO => '无折扣',
  16. self::DISCOUNT_YES => '有折扣',
  17. ];
  18. const STATUS_OK = 1;
  19. const STATUS_NO = 0;
  20. public static $statusMaps = [
  21. self::STATUS_OK => '启用',
  22. self::STATUS_NO => '停用',
  23. ];
  24. const GIVE_OK = 1;
  25. const GIVE_NO = 0;
  26. public static $giveMaps = [
  27. self::GIVE_OK => '可赠送',
  28. self::GIVE_NO => '不可赠送',
  29. ];
  30. public function areaRidingCard()
  31. {
  32. return $this->belongsToMany(
  33. Area::class,
  34. 'card_riding_area',
  35. 'riding_card_id',
  36. 'area_id'
  37. )->withTimestamps();
  38. }
  39. }