Find two column in laravel which have equal values via Eloquent?

前端 未结 3 2018
孤城傲影
孤城傲影 2021-02-07 03:09

I am working on a project where I have a table market which has a buyer_id column and a seller_id column. When a seller puts something on the market, the seller_id and buyer_id

3条回答
  •  -上瘾入骨i
    2021-02-07 04:00

    In recent Laravel versions you can use whereColumn (docs):

    $same = Market::whereColumn('seller_id', 'buyer_id')->get();
    

提交回复
热议问题