123456789101112131415161718192021222324252627282930313233343536373839404142434445 |
- <?php
- namespace App\Models;
- use Illuminate\Database\Eloquent\Model;
- class Parking extends Model
- {
- protected $guarded = [];
- // 还车点的标识
- const REDIS_STOP_BIKE_SITE_TAG = 'stop_bike_sites';
- const REDIS_BAN_STOP_BIKE_SITE_TAG = 'stop_ban_bike_sites';
- const REDIS_BAN_STOP_BIKE_ALL_SITE_TAG = 'stop_ban_bike_all_sites';
- const STATUS_OK = 1;
- const STATUS_PAUSE = 0;
- public static $statusMaps = [
- self::STATUS_OK => '正常',
- self::STATUS_PAUSE => '暂停'
- ];
- const TYPE_STOP_BIKE = 2;
- const TYPE_NO_STOP_BIKE = 1;
- public static $typeMaps = [
- self::TYPE_STOP_BIKE => '停车区',
- self::TYPE_NO_STOP_BIKE => '禁停区'
- ];
- public function getParkingCentreAttribute($value)
- {
- return js2php($value);
- }
- public function getParkingFenceAttribute($value)
- {
- return js2php($value);
- }
- public function scopeActive($query)
- {
- return $query->where('status', self::STATUS_OK);
- }
- }
|