Search
 
SCRIPT & CODE EXAMPLE
 

PHP

group where conditions in laravel

<?php

$results = DB::table('table')
             ->where(function($query) use ($starttime,$endtime){
                 $query->where('starttime', '<=', $starttime);
                 $query->where('endtime', '>=', $endtime);
             })
             ->orWhere(function($query) use ($otherStarttime,$otherEndtime){
                 $query->where('starttime', '<=', $otherStarttime);
                 $query->where('endtime', '>=', $otherEndtime);
             })
             ->orWhere(function($query) use ($anotherStarttime,$anotherEndtime){
                 $query->where('starttime', '>=', $anotherStarttime);
                 $query->where('endtime', '<=', $anotherEndtime);
             })
             ->get();
Comment

PREVIOUS NEXT
Code Example
Php :: 413 error laravel 
Php :: how to check if all values in an array are equal php 
Php :: php artisanmigrate 
Php :: php datetime from timestamp 
Php :: select option in laravel 
Php :: install laravel on windows 
Php :: PHP strtoupper — Make a string uppercase 
Php :: a php session was created by a session_start() 
Php :: search laravel 
Php :: laravel update query builder 
Php :: Package phpoffice/phpexcel is abandoned, you should avoid using it. Use phpoffice/phpspreadsheet instead. 
Php :: how get the photo size upload in laravel 
Php :: Genrate Random number in php 
Php :: send json reponse php 
Php :: internal server error phpmyadmin 
Php :: delete data with ajax in php 
Php :: get value mentthod get laravel 
Php :: setcookie in php 
Php :: run laravel project on localhost 
Php :: status messages wordpress settings form 
Php :: softDelete laravel8 
Php :: htaccess redirect https laravel 
Php :: drop table phpmyadmin 
Php :: switch php version ubuntu 20.04 
Php :: start php cli 
Php :: orwhere in wherehas laravel 
Php :: get all users created in a month laravel 
Php :: clear session in laravel 
Php :: move img to public folder in laravel 
Php :: laravel route with multiple parameters 
ADD CONTENT
Topic
Content
Source link
Name
4+4 =