I have a data table with several status condition.
For example:
status = "pending","approved","rejected"
.
How to use eloquent query to select the column for status "pending", "rejected" only?
I have a data table with several status condition.
For example:
status = "pending","approved","rejected"
.
How to use eloquent query to select the column for status "pending", "rejected" only?
If you need to select data where status is pendning
or rejected
, use whereIn()
:
Model::whereIn('status', ['pending', 'rejected'])->get();
Or orWhere()
:
Model::where('status', 'pending')->orWhere('status', 'rejected')->get();