DB::table('messages')
->join('deleted_messages', 'messages.id', '=', 'deleted_messages.message_id')
->where('chat_id', $this->id)
->where('deleted_messages.message_id', '!=','messages.id')
->get();
SELECT *
FROM messages
LEFT JOIN deleted_messages
ON messages.id = deleted_messages.message_id
WHERE
messages.chat_id = :id
AND
deleted_messages.message_id IS NULL