Laravel-admin: 如何创建关系查询

Created on 20 Dec 2017  ·  2Comments  ·  Source: z-song/laravel-admin

  • Laravel Version: 4.5
  • PHP Version:
  • Laravel-admin: 1.4

Description:

$grid->filter(function($filter){}中如何创建关联表的LIKE查询,已对应好关系

Steps To Reproduce:

$filter->where(function ($query) {
    $query->whereHas('profile', function ($query) {
        $query->where('address', 'like', "%{$this->input}%")->orWhere('email', 'like', "%{$this->input}%");
    });
}, '地址或手机号');

上面是官方1.5文档的写法,我照着写报错,我在1.4的文档中好像没有看到,是因为1.4没有嘛?

Most helpful comment

报什么错?1.4应该是有的

All 2 comments

报什么错?1.4应该是有的

已解决,是我自己写错了,where的第二个参数放错地方了。。。。一层一层的方法。。

Was this page helpful?
0 / 5 - 0 ratings

Related issues

benny-sun picture benny-sun  ·  3Comments

abufalbo picture abufalbo  ·  3Comments

vlongen picture vlongen  ·  3Comments

evans-kim picture evans-kim  ·  3Comments

piian picture piian  ·  3Comments