You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
798 B

8 years ago
8 years ago
8 years ago
  1. <?php
  2. namespace App\Http\Model;
  3. use Illuminate\Database\Eloquent\Model;
  4. use App\Common\Token;
  5. use Cache;
  6. class Region extends BaseModel
  7. {
  8. //地区
  9. protected $table = 'region';
  10. public $timestamps = false;
  11. public static function getRegionName($id)
  12. {
  13. $res = self::where('id', $id)->value('name');
  14. if (!empty($res))
  15. {
  16. return $res;
  17. }
  18. return false;
  19. }
  20. public static function getList($parent_id=86)
  21. {
  22. return self::where('parent_id', $parent_id)->get()->toArray();
  23. }
  24. public static function getOne($id)
  25. {
  26. $res = self::where('id', $id)->first()->toArray();
  27. if (!empty($res))
  28. {
  29. return $res;
  30. }
  31. return false;
  32. }
  33. }