I have two columns in my table: max
and current
. I want to build simple scope
public function scopeNotMax($query)
{
return $query->where('max', '>', 'current');
}
But Laravel gives me that query:
SELECT * FROM table WHERE `max` > 'current'
I don't want this result and I know that I can use in this place whereRaw()
or DB::raw()
. But I can't find another way to say "hey, this is column, not string!'. Can I do it? Or I must use raws? I want to avoid it.