Parking.php 951 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  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 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. }