Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jarektkaczyk/22716faa21f2ff15ba56018f9ed3481d to your computer and use it in GitHub Desktop.
Save jarektkaczyk/22716faa21f2ff15ba56018f9ed3481d to your computer and use it in GitHub Desktop.
<?php
// assuming you want to get conv where last message doesn't come from the OP
Coversation::where('author_id', '!=', function ($q) {
$q->select('author_id')->from('messages')->whereRaw('conversation_id = conversations.id')->latest()->limit(1);
})->get()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment