Parking.php 1023 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. class Parking extends Model
  5. {
  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 REDIS_BAN_STOP_BIKE_ALL_SITE_TAG = 'stop_ban_bike_all_sites';
  11. const STATUS_OK = 1;
  12. const STATUS_PAUSE = 0;
  13. public static $statusMaps = [
  14. self::STATUS_OK => '正常',
  15. self::STATUS_PAUSE => '暂停'
  16. ];
  17. const TYPE_STOP_BIKE = 2;
  18. const TYPE_NO_STOP_BIKE = 1;
  19. public static $typeMaps = [
  20. self::TYPE_STOP_BIKE => '停车区',
  21. self::TYPE_NO_STOP_BIKE => '禁停区'
  22. ];
  23. public function getParkingCentreAttribute($value)
  24. {
  25. return js2php($value);
  26. }
  27. public function getParkingFenceAttribute($value)
  28. {
  29. return js2php($value);
  30. }
  31. public function scopeActive($query)
  32. {
  33. return $query->where('status', self::STATUS_OK);
  34. }
  35. }