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.
42 lines
806 B
42 lines
806 B
<?php
|
|
namespace App\Http\Model;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use App\Common\Token;
|
|
|
|
class Region extends BaseModel
|
|
{
|
|
//地区
|
|
|
|
protected $table = 'region';
|
|
public $timestamps = false;
|
|
|
|
public static function getRegionName($id)
|
|
{
|
|
if(empty($id)){return '';}
|
|
|
|
$res = self::where('id', $id)->value('name');
|
|
if (!empty($res))
|
|
{
|
|
return $res;
|
|
}
|
|
|
|
return '';
|
|
}
|
|
|
|
public static function getList($parent_id=86)
|
|
{
|
|
return self::where('parent_id', $parent_id)->get();
|
|
}
|
|
|
|
public static function getOne($id)
|
|
{
|
|
$res = self::where('id', $id)->first();
|
|
if (!empty($res))
|
|
{
|
|
return $res;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|