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.

41 lines
806 B

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