Parkings.php 951 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Models;
  3. class Parkings extends Model
  4. {
  5. protected $table = 'parking_old';
  6. protected $guarded = [];
  7. // 还车点的标识
  8. const REDIS_STOP_BIKE_SITE_TAG = 'stop_bike_sites';
  9. const REDIS_BAN_STOP_BIKE_SITE_TAG = 'stop_ban_bike_sites';
  10. const STATUS_OK = 1;
  11. const STATUS_PAUSE = 0;
  12. public static $statusMaps = [
  13. self::STATUS_OK => '正常',
  14. self::STATUS_PAUSE => '暂停'
  15. ];
  16. const TYPE_STOP_BIKE = 2;
  17. const TYPE_NO_STOP_BIKE = 1;
  18. public static $typeMaps = [
  19. self::TYPE_STOP_BIKE => '停车区',
  20. self::TYPE_NO_STOP_BIKE => '禁停区'
  21. ];
  22. public function getParkingCentreAttribute($value)
  23. {
  24. return js2php($value);
  25. }
  26. public function getParkingFenceAttribute($value)
  27. {
  28. return js2php($value);
  29. }
  30. public function scopeActive($query)
  31. {
  32. return $query->where('status', self::STATUS_OK);
  33. }
  34. }