Hi mate,
I think you are looking for something like this:
$foo = MyModel::where('user_id', '=', $user_id)->whereNotIn( 'id', [1, 2, 7])->get();
HI,
The above query works fine . So far i am trying to get using the below query
Wrong Way :
User::orderby('username')->where('company', '=', $company_id and 'id' '!=' $user_id)->get();
gives sql error.
Correct one :
User::orderby('username')->where('company', '=', $company_id)->whereNotIn( 'id', [$user_id])->get();
Out put of query :
select * from `users` where `company` = 2 and `id` not in (4)
Thanks for your right syntax query
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community