Search
 
SCRIPT & CODE EXAMPLE
 

PHP

eloquent where in

$users = DB::table('users')->whereIn('id', array(1, 2, 3))->get()
Comment

Laravel Eloquent Query Using WHERE with OR AND OR?

Make use of Logical Grouping (Laravel 7.x/4.2). For your example, it'd be something like this:

Model::where(function ($query) {
    $query->where('a', '=', 1)
          ->orWhere('b', '=', 1);
})->where(function ($query) {
    $query->where('c', '=', 1)
          ->orWhere('d', '=', 1);
});
Comment

laravel where

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

where () laravel Eloquent

//los signos de igualdad pueden ser: ">=", "<=", "=", ">", "<"
$user = User::where("estado","=",1)->find(10);
Comment

where in laravel

$users = Users::whereIn('id', array(1, 2, 3))->get()
Comment

laravel where in

$users = DB::table('users')->whereIn('id', array(1, 2, 3))->get()
Comment

laravel where and where

Table::where('Column', Value)->where('NewColumn', Value)->get();
Comment

laravel where() method

<?php

namespace AppHttpControllers;

use AppModelsPost;
use IlluminateHttpRequest;

class PageController extends Controller
{
    //
    public function index(){

        $posts = Post::latest("id")->get();
        return view("index",["posts"=>$posts]);//compact($posts)
    }

    public function detail($slug){
        $post = Post::where("slug",$slug)->firstOrfail();
        return  view('post.detail',compact('post'));
        return $slug;
    }
}
Comment

laravel where

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

PREVIOUS NEXT
Code Example
Php :: url() inside laravel config files 
Php :: get authinticated user id laravel 
Php :: laravel many to many relation update 
Php :: curl post laravel 
Php :: laravel value eloquent 
Php :: laravel factory 
Php :: pass image path in laravel blade 
Php :: laravel get age from date 
Php :: macos how host laravel website on localhost and intranet wifi 
Php :: convert array into , separated string in php 
Php :: php loop html select option 
Php :: how naming resource routes laravel 
Php :: laravel factory relationship one to many 
Php :: how to get structure of table in codeigniter 
Php :: php time() 
Php :: get node id in twig drupal 
Php :: how to read sqlite file in php 
Php :: axios post not sending data php 
Php :: how to set select option value dynamically in php 
Php :: null value in php 
Php :: custom autoload without composer php psr4 
Php :: php timeout 
Php :: phpmailer addattachment 
Php :: laravel capsule schema datatime CURRENT_TIMESTAMP 
Php :: composer dump autoload laravel 
Php :: maatwebsite/excel package 5.2 laravel 
Php :: how to delete item from array php 
Php :: php append n time pattern to string 
Php :: php stop loading page 
Php :: worpdress pods taxonomy get custom field 
ADD CONTENT
Topic
Content
Source link
Name
2+6 =