$users = DB::table('users')->whereIn('id', array(1, 2, 3))->get()
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);
});
$users = DB::table('users')
->whereDate('created_at', '2016-12-31')
->get();
//los signos de igualdad pueden ser: ">=", "<=", "=", ">", "<"
$user = User::where("estado","=",1)->find(10);
$users = Users::whereIn('id', array(1, 2, 3))->get()
$users = DB::table('users')->whereIn('id', array(1, 2, 3))->get()
Table::where('Column', Value)->where('NewColumn', Value)->get();
<?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;
}
}
$users = DB::table('users')
->whereMonth('created_at', '12')
->get();