CardRiding.php 899 B

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