Laravel Eloquent OR WHERE IS NOT NULL Laravel Eloquent OR WHERE IS NOT NULL sql sql

Laravel Eloquent OR WHERE IS NOT NULL


Just add withTrashed:

'query_filter'=> function($query) {    $query->withTrashed();},

Source

Update

In that case, you can probably just add a orWhereNotNull() call:

'query_filter'=> function($query) {    $query->orWhereNotNull('deleted_at');},


If you want to search deleted record (Soft Deleted Record), don't user Eloquent Model Query.
Instead use Db::table query
e.g
Instead of using Below:

$stu = Student::where('rollNum', '=', $rollNum . '-' . $nursery)->first();

Use

$stu = DB::table('students')->where('rollNum', '=', $newRollNo)->first();


Eloquent has a method for (Laravel 4.* | 5.*):

Model::whereNotNull('sent_at')

Laravel 3: Model::where_not_null('sent_at')