1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495 |
- <?php
- namespace catchAdmin\stations\model;
- use catchAdmin\permissions\model\Department;
- trait StationSearch
- {
- /**
- * 基站名称
- */
- public function searchStationNameAttr($query, $value, $data)
- {
- return $query->where('station_name', 'like', '%'. $value . '%');
- }
- /**
- * 基站类型
- */
- public function searchStationTypeAttr($query, $value, $data)
- {
- return $query->where('station_type',$value);
- }
- /**
- * 基站mac
- */
- public function searchStationMacAttr($query, $value, $data)
- {
- return $query->where('station_mac',$value);
- }
- /**
- * 基站简码
- */
- public function searchStationCodeAttr($query, $value, $data)
- {
- return $query->where('station_code',$value);
- }
- /**
- * 省
- */
- public function searchProvinceIdAttr($query, $value, $data)
- {
- return $query->where('province_id',$value);
- }
- /**
- * 市
- */
- public function searchCityIdAttr($query, $value, $data)
- {
- return $query->where('city_id',$value);
- }
- /**
- * 县
- */
- public function searchDistrictIdAttr($query, $value, $data)
- {
- return $query->where('district_id',$value);
- }
- /**
- * 学校id
- */
- public function searchSchoolIdAttr($query, $value, $data)
- {
- return $query->where('school_id',$value);
- }
- /**
- * 年级id
- */
- public function searchGradeIdAttr($query, $value, $data)
- {
- return $query->where('grade_id',$value);
- }
- /**
- * 建筑id
- */
- public function searchBuildingIdAttr($query, $value, $data)
- {
- return $query->where('building_id',$value);
- }
- /**
- * 楼层id
- */
- public function searchFloorIdAttr($query, $value, $data)
- {
- return $query->where('floor_id',$value);
- }
- /**
- * 城市:省/市/区/
- */
- public function searchCitysAttr($query, $value, $data)
- {
- if (empty($value)) {
- return $query;
- }
- return $query->where('province_id|city_id|district_id', 'in', $value);
- }
- }
|