Skip to content
  • About Us
  • Contact Us
  • Privacy Policy
  • Terms & Conditions
  • Site Map

XpertPhp

Expertphp Is The Best Tutorial For Beginners

  • Home
  • Javascript
    • Jquery
    • React JS
    • Angularjs
    • Angular
    • Nodejs
  • Codeigniter
  • Laravel
  • Contact Us
  • About Us
  • Live Demos
laravel 6 where clauses

laravel 6 where clauses methods example tutorial

Posted on February 2, 2020January 25, 2021 By XpertPhp 1 Comment on laravel 6 where clauses methods example tutorial

In this article, We will explain to you how to use where clauses Method in laravel 6. The laravel eloquent provides many types of where clauses methods. like as where, orWhere, whereBetween, whereNotBetween, whereIn, whereNotIn, whereNull, whereNotNull, whereDate, whereMonth, whereDay, whereYear, whereTime and whereColumn.

Normally we want to need when filter data into the table. At that time we use the Where Clauses Methods. so let’s see below an example of Where Clauses Methods.

Where Clause

1
$users = DB::table('users')->where('votes', '=', 100)->get();

orWhere Clause

1
2
3
4
$users = DB::table('users')
                    ->where('votes', '>', 100)
                    ->orWhere('name', 'John')
                    ->get();

whereBetween Clause

1
2
$users = DB::table('users')
                    ->whereBetween('votes', [1, 100])->get();

whereNotBetween Clause

1
2
3
$users = DB::table('users')
                    ->whereNotBetween('votes', [1, 100])
                    ->get();

whereIn Clause

1
2
3
$users = DB::table('users')
                    ->whereIn('id', [1, 2, 3])
                    ->get();

whereNotIn Clause

1
2
3
$users = DB::table('users')
                    ->whereNotIn('id', [1, 2, 3])
                    ->get();

whereNull Clause

1
2
3
$users = DB::table('users')
                    ->whereNull('updated_at')
                    ->get();

whereNotNull Clause

1
2
3
$users = DB::table('users')
                    ->whereNotNull('updated_at')
                    ->get();

whereDate Clause

1
2
3
$users = DB::table('users')
                ->whereDate('created_at', '2016-12-31')
                ->get();

whereMonth Clause

1
2
3
$users = DB::table('users')
                ->whereMonth('created_at', '12')
                ->get();

whereDay Clause

1
2
3
$users = DB::table('users')
                ->whereDay('created_at', '31')
                ->get();

whereYear Clause

1
2
3
$users = DB::table('users')
                ->whereYear('created_at', '2016')
                ->get();

whereTime Clause

1
2
3
$users = DB::table('users')
                ->whereTime('created_at', '=', '11:20:45')
                ->get();

whereColumn Clause

1
2
3
$users = DB::table('users')
                ->whereColumn('first_name', 'last_name')
                ->get();

Please follow and like us:
error
fb-share-icon
Tweet
fb-share-icon

Recommended Posts:

  • How to Check If Value Exists in a Javascript Array
  • how to remove specific element from array in Javascript
  • how to get textbox value in javascript
  • How to Get Client Ip Address Using JavaScript
  • Codeigniter 4 cURL Delete Request Example Tutorial
Javascript Tags:Laravel 6 Eloquent, laravel where, laravel wherein, Where Clauses, wherein laravel

Post navigation

Previous Post: Laravel 6 join clause example tutorial
Next Post: Drag and Drop File Upload in Laravel 6 Using Dropzone js

Categories

  • Ajax
  • Angular
  • Angularjs
  • Bootstrap
  • Codeigniter
  • Css
  • Htaccess
  • Javascript
  • Jquery
  • Laravel
  • MongoDB
  • MySql
  • Nodejs
  • Php
  • React JS
  • Shopify Api
  • Ubuntu

Tags

angular 10 tutorial angular 11 ci tutorial codeigniter 4 image upload Codeigniter 4 Tutorial codeigniter tutorial CodeIgniter tutorial for beginners codeigniter with mysql crud operation eloquent relationships file upload File Validation form validation Image Upload jQuery Ajax Form Handling jquery tricks jquery tutorial laravel 6 Laravel 6 Eloquent Laravel 6 Model laravel 6 relationship laravel 6 relationship eloquent Laravel 6 Routing laravel 7 Laravel 7 Eloquent laravel 7 routing laravel 7 tutorial Laravel 8 laravel 8 example laravel 8 tutorial laravel 9 example laravel 9 tutorial Laravel Framework laravel from scratch Laravel Socialite laravel social login nodejs pagination payment gateway php with mysql react js tutorial rewrite rule send mail validation wysiwyg editor

Latest Posts

  • How to Convert Date and Time from one timezone to another in php
  • how to get current date and time in php
  • Drag and Drop Reorder Items with jQuery, PHP & MySQL
  • Laravel 9 Toastr Notifications Example Tutorial
  • Laravel 9 CRUD Operation Example Using Google Firebase
  • Laravel 9 CKeditor Image Upload With Example
  • Laravel 9 Summernote Image Upload With Example
  • Laravel 9 Stripe Payment Gateway Integrate Example
  • How To Send Email Using Mailtrap In Laravel 9
  • Laravel 9 Fullcalendar Ajax Example Tutorial

Tools

  • Compound Interest Calculator
  • Hex to RGB Color Converter
  • Pinterest Video Downloader
  • Age Calculator Online
  • Convert JSON to PHP Array Online
  • JavaScript Minifier
  • CSS Beautifier
  • CSS Minifier
  • JSON Beautifier
  • JSON Minifier

Copyright © 2018 - 2022,

All Rights Reserved Powered by XpertPhp.com