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
Post a Comment