php - Laravel 5.3 active record OR -


can ask how on laravel 5.3 in objects? used local scope method. far confused using or in objects. thanks.

$sql = "select * `conversations` (`conversations`.`user_id` = 1 , `conversations`.`chat_id` = 2) or (`conversations`.`user_id` = 2 , `conversations`.`chat_id` = 1)"; 

try this:

$conversation = conversation::where(function($q) {         $q->where('user_id', 1);         $q->where('chat_id', 2);     })->orwhere(function($q) {         $q->where('user_id', 2);         $q->where('chat_id', 1);     })->get(); 

if want use variables, don't forget pass them use().


Comments

Popular posts from this blog

How to use SUM() in MySQL for calculated values -

ios - IBOutlet for image button not correctly referencing button after recreating outlet -

java - AEM: 403 Forbidden occurs when call a Post servlet -