DekGenius.com
PHP
or where laravel
MyMode::where(['user_id' => 1])
->orWhere(['assigned_to' => 1])
->get();
laravel where
$users = DB::table('users')
->whereDate('created_at', '2016-12-31')
->get();
where () laravel Eloquent
//los signos de igualdad pueden ser: ">=", "<=", "=", ">", "<"
$user = User::where("estado","=",1)->find(10);
where in laravel
$users = Users::whereIn('id', array(1, 2, 3))->get()
laravel with and where
$projects = Project::whereHas('projectOffers', function ($offer) {
$offer->where('teacher_id', "Ahmed");
$offer->where('status_id', "Accepted");
})->where('status_id', "inprogress")->get();
laravel where in
$users = DB::table('users')->whereIn('id', array(1, 2, 3))->get()
where clause in laravel
$users = DB::table('user')->select('id', 'name', 'email','api_token','created_at')->where('email' , $email)->get();
return response()->json($users);
laravel where and where
Table::where('Column', Value)->where('NewColumn', Value)->get();
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;
}
}
laravel where
$users = DB::table('users')
->whereMonth('created_at', '12')
->get();
how to use or where in laravel
if (!empty($search)){
$member = $member->where(function($q)use($search){$q->where('name', 'LIKE', '%' . $search . '%')->orWhere('contact', 'LIKE', '%' . $search . '%')->orWhere('contact02', 'LIKE', '%' . $search . '%')->orWhere('email', 'LIKE', '%' . $search . '%')->orWhere('blood_group', 'LIKE', '%' . $search . '%'); });
}
© 2022 Copyright:
DekGenius.com