【发布时间】:2018-06-16 10:37:47
【问题描述】:
我收到此错误:
Illuminate\Database\Eloquent\Builder 类的对象无法转换为字符串
当我运行这段代码时:
public function index()
{
save_resource_url();
//$items = News::with(['category', 'photos'])->get();
$items = Solicitud::rightjoin(News::with(['category', 'photos']),'news.id','=','solicitud.event_id')->count('*','event_id','as','total')->get();
return $this->view('news_events.index', compact('items'));
}
我原来的sql查询
SELECT *,count(event_id) as total FROM solicitud RIGHT JOIN news ON news.id = solicitud.event_id group by title;
【问题讨论】: