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
828 B
42 lines
828 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()->toArray();
|
|
}
|
|
|
|
public static function getOne($id)
|
|
{
|
|
$res = self::where('id', $id)->first()->toArray();
|
|
if (!empty($res))
|
|
{
|
|
return $res;
|
|
}
|
|
|
|
return false;
|
|
}
|
|
}
|