Is there a way to translate the following syntax to laravel query builder?
SELECT *
FROM table_1
INNER JOIN table_2 ON table_1.id = table_2.id
INNER JOIN table_3 ON
(CASE
WHEN {some condition}
THEN table_1.id
ELSE table_2.id
END) = table_3.id;