In laravel elequent query how to make these two where select in one.
I also feels if there too many conditions, I've too use too many where clause.
->where('trade_status', '<>', 'TRADE_FINISHED')
->where('trade_status', '<>', 'TRADE_SUCCESS')
In laravel elequent query how to make these two where select in one.
I also feels if there too many conditions, I've too use too many where clause.
->where('trade_status', '<>', 'TRADE_FINISHED')
->where('trade_status', '<>', 'TRADE_SUCCESS')
Use whereNotIn()
:
->whereNotIn('trade_status', ['TRADE_FINISHED', 'TRADE_SUCCESS']);
Here in documentation you can notice
You can pass array of condition like
$users = DB::table('users')->where([
['status', '=', '1'],
['subscribed', '<>', '1'],
])->get();
for your condition it should be like
DB::table('your_table')->where([
['trade_status', '<>', 'TRADE_FINISHED'],
['trade_status', '<>', 'TRADE_SUCCESS'],
])->get();