", $ips_get->id)->first();$next_active->update(["a">
时间:2021-07-01 10:21:17 帮助过:126人阅读
$next_active = $ips->where("id", ">", $ips_get->id)->first();
$next_active->update(["active" => "yes"]);
我想获取下一条把它的active字段更改为yes,但是这样貌似获取不到
$next_active = $ips->where("id", ">", $ips_get->id)->first();
$next_active->update(["active" => "yes"]);
可以直接戳链接:http://segmentfault.com/a/1190000003019456
楼主的问题基本可以这样解决:
protected function getNextArticleId($current_id)
{
return Article::where('id', '>', $current_id)->min('id');
}
然后
Article::find($this->getNextArticleId($current_article->id))->update(...);
至于Article
,请自行替换成你的Model,Happy Hacking。