php - Need to compare two rows from the DB in Laravel -
i have table users
in laravel.
a user has, among other things, id
, owner_id
.
i want perform query owners. means, id
equal owner_id
.
users::where('id','owner_id')->get();
something this. didn't work obviously.
any suggestions?
use wherecolumn
instead.
users::wherecolumn('id','owner_id')->get();
with where
, you're looking literal string 'owner_id'.
Comments
Post a Comment