Created
January 3, 2018 15:28
-
-
Save armyofda12mnkeys/74743d264ace8e74779bd1ab8be7957c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$data = SomeModel:join('table2', 'column1', 'column2') | |
->join('table3', 'column1', 'column2') | |
->where table1.some_column = 'x' | |
->where table2.some_column = 'y' | |
->where table3.some_column = 'z' | |
->orderBy('table2.score') | |
->select('column1,column2,column3') | |
->distinct(); | |
When i do a ->toSql() and review the query i see it includes deleted rows of table 2 or table 3 so i have to explicitly remove with something like this: | |
->whereNull('table2.deleted_at') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment