protected $table = 'user_city';
public $timestamps = false;
//添加 返回id
public function cityadd($data)
{
return $this->insertGetId($data);
}
//单条查找
public function getfind($id)
{
if($this->where('id',$id)->first()){
return $this->where('id',$id)->first()->toArray();
}else{
return [];
}
}
//查询用户有几个uid,返回数量
public function countCity($uid){
if($this->where('uid',$uid)->first()){
return $this->where('uid',$uid)->count();
}else{
return [];
}
}
//查询全部数据
public function getAll()
{
return $this->get()->toArray();
}
/**
* 修改管理员信息
* @param $id
* @param $data
* @return bool
*/
public function upAdmin($id,$data)
{
if($this->find($id)){
return $this->where('id
laravel 框架在model层的增删改查
最新推荐文章于 2024-01-11 17:24:29 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)