I
I
Ivan2021-08-13 08:06:30
Laravel
Ivan, 2021-08-13 08:06:30

How can you check if a value exists in a particular column using standard methods?

Hello. Is it possible to check, as standard, whether a particular value exists in a particular table and database column? Or just counts like this:

$isExists = User::where('email', $request->email)->count()

if (!$isExists) {
   // do something
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2021-08-13
@Djonson86

User::where('email', $request->email)->exists()

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question