Laravel eloquent where error with <>

前端 未结 3 2363
栀梦
栀梦 2021-02-20 03:02

I have query for where in native php

where type <> \'point\'

and I try convert to eloquent laravel<

3条回答
  •  难免孤独
    2021-02-20 03:31

    to parse the dynamic parameters within query try this :

    $string = 'points';
    ->with(['payments' => function ($query) use ($string) {
        $query->where('type', '<>', $string);
    }])
    

    this will work!!

提交回复
热议问题