I want to show only the people the user is messaging, but all users are showing. How can i fix this?
SQL PHOTO: https://i.stack.imgur.com/6pOPa.png
public static function otherUserData($user_id)
{
$value = DB::table('users')
->select(['*', DB::raw('MAX(conver_date) AS lastConver')])
->leftJoin('conversation', function ($join) use ($user_id) {
$join->on('conversation.conver_seller_id', '=', 'users.id')
->on('conversation.conver_user_id', '=', DB::raw($user_id))
->orOn('conversation.conver_seller_id', '=', DB::raw($user_id))
->on('conversation.conver_user_id', '=', 'users.id');
})
->where('user_type', '!=', 'admin')
->where('id', '!=', $user_id)
->where('drop_status', '=', 'no')
->orderBy('lastConver', 'desc')
->groupBy('id')
->get();
return $value;
}
I would be very grateful if you could help.
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/F67L4SU
via IFTTT
Aucun commentaire:
Enregistrer un commentaire