【发布时间】:2018-05-02 06:55:13
【问题描述】:
过滤器查询有问题。我需要做一些像
select painting from artist_painting where type=$_GET['type'] AND material=$_GET['material'] and artist_slug =$_GET['artist_slug'] ORDER BY painting DESC
我有一个数据透视表 Artist_painting 和艺术家。 “artist_slug”在“艺术家”表中
我愿意
$this['painting'] = Painting::whereHas('artist', function($q)
{
$q->where('artist_slug', '=', $this->param('slug'));
})->get();
但我不知道下一步该做什么。 如何在 php 代码中进行查询?
【问题讨论】:
-
你定义了模型之间的关系吗?
标签: laravel octobercms