Select specific columns with a condition in Laravel

REZAZI MOHAMED ABDESSAMED

lets say that i have user table that has many users in it. I want to get all users but not the auth user. How can i do that in a simple query?, i tried:

$users = User::whereNotIn('id',auth()->user()->id)->get();

But it didn't work. Any help please? and sorry for this simple question.

Pradeep

In and NotIn need an array as second args

$users = User::whereNotIn('id',[auth()->id()])->get();

for more : https://laravel.com/docs/8.x/collections#method-wherenotin

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

Select specific columns in pandas DataFrame

Select range of columns by condition in Pandas

How to select specific columns in laravel eloquent

Laravel 5 Eloquent scope join and select specific columns

Intersect Select Statements on Specific Columns

Select only specific columns of CSV

pandas select conditionally specific columns in dataframe with another condition results in concatenation

Select columns that satisfy a condition

Select query for laravel to get specific rows based on a condition at top remaining columns at bottom

How do I select specific columns of a data frame, and sum them based on a condition?

Select specific column value from multiple relational table using where condition in Laravel ORM

How to select columns based on a condition?

sum with a specific condition in select

Laravel select specific columns with Eloquent while eager loading

How to select specific columns from nested relationships in a query with Laravel

Select Specific columns from multiple Table with with() and select ()

Sum Specific Columns for Select Statement

Select specific columns determined by the headers

Python pandas: Select columns where a specific row satisfies a condition

Select the columns based on the condition

Select columns that have a specific type

Query to select limit in specific condition

Joining columns in pandas with specific condition

Select columns in pyrhon based on a condition

Select the count of columns with values with specific name for the columns

Select user id with specific condition

How can i select specific columns that start with a word according to a condition of another column in R using dplyr?

Select specific/all columns in rowwise

rowsums of specific columns filling a condition