12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152 |
- <?php
- /**
- * Created by PhpStorm.
- * User: Mead
- * Date: 2019/8/6
- * Time: 9:16 PM
- */
- namespace App\Repositories;
- use App\Models\Area;
- use Illuminate\Support\Facades\Redis;
- class AreaRepository extends BaseRepository
- {
- private static $filed = [
- 'name',
- 'area_fence',
- 'customer_service_time',
- 'customer_service_phone',
- 'status'
- ];
- public function __construct(Area $area)
- {
- $this->model = $area;
- }
- public function byIdGetModelRedis($id)
- {
- $area = Redis::connection()->hget(Area::REDIS_AREAS_TAG, $id);
- if ($area) {
- $area = unserialize($area);
- $area['area_fence'] = js2php($area['area_fence']);
- $area['area_centre'] = js2php($area['area_centre']);
- $area['area_fushe_fence'] = js2php($area['area_fushe_fence']);
- return $area;
- }
- return false;
- }
- public function all()
- {
- return $this->model->active()->get();
- }
- public function getFieldAreas()
- {
- return $this->model->select(self::$filed)->get();
- }
- }
|