In this article, We will explain to you how to use WhereNotBetween query in laravel(laravel eloquent whereNotBetween query example). here we will give you a simple example of laravel eloquent WhereNotBetween() method.
The laravel eloquent provides many types of eloquent methods. The WhereNotBetween method will return the data column’s value between two values like a check between two dates.
Read Also:
laravel eloquent WhereBetween query example
laravel eloquent WhereBetween query example
Example 1
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Student; class StudentController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $student_detail = Student::select("*") ->WhereNotBetween('marks', [1, 100]) ->get(); dd($student_detail); } }
Example 2
<?php namespace App\Http\Controllers; use Illuminate\Http\Request; use App\Student; use Carbon\Carbon; class StudentController extends Controller { /** * Display a listing of the resource. * * @return \Illuminate\Http\Response */ public function index() { $start = Carbon::now()->subDays(30); $end = Carbon::now(); $student_detail = Student::select("*") ->WhereNotBetween('created_at', [$start, $end]) ->get(); dd($student_detail); } }
Please follow and like us: