z-song / laravel-admin

Build a full-featured administrative interface in ten minutes
https://laravel-admin.org
MIT License
11.13k stars 2.81k forks source link

whereRaw in relation #5666

Open sunsophearoth opened 1 year ago

sunsophearoth commented 1 year ago

Laravel Version: 5.6 PHP Version: 7.3 Laravel-admin:1.7

Description: I want to do whereRaw with relation . It reloads back to long with no result or error. In model if i change where to other it works normal.

Here is my filter : $filter->where(function ($query) { $query->whereHas('loan', function ($query) { $query->whereRaw("TIMESTAMPDIFF(month,sys_loan.payment_date,now()) = {$this->input} "); $query->where('sys_loan.is_active', 1); $query->where('sys_loan.is_paid', 0); }); }, 'ចំនួនខែអតិថិជនមិនទាន់បង់ប្រាក់')->select([ 0 => '1 ខែ', 1 => '2 ខែ', 2 => '3 ខែ', 3 => '4​ ខែ', 4 => '5 ខែ', 5 => '6 ខែ', 6 => '7 ខែ', 7 => '8 ខែ', 8 => '9 ខែ', 9 => '10 ខែ', 10 => '11 ខែ', 11 => '12 ខែ', 12 => '>12 ខែ', ]);

Steps To Reproduce: