File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -77,6 +77,26 @@ public function joinRelationshipUsingAlias()
7777 };
7878 }
7979
80+ /**
81+ * Left join the relationship(s) using table aliases.
82+ */
83+ public function leftJoinRelationshipUsingAlias ()
84+ {
85+ return function ($ relationName , $ callback = null ) {
86+ return $ this ->joinRelationship ($ relationName , $ callback , 'leftJoin ' , true );
87+ };
88+ }
89+
90+ /**
91+ * Right join the relationship(s) using table aliases.
92+ */
93+ public function rightJoinRelationshipUsingAlias ()
94+ {
95+ return function ($ relationName , $ callback = null ) {
96+ return $ this ->joinRelationship ($ relationName , $ callback , 'rightJoin ' , true );
97+ };
98+ }
99+
80100 public function joinRelation ()
81101 {
82102 return function ($ relationName , $ callback = null , $ joinType = 'join ' ) {
@@ -368,8 +388,8 @@ public function clearPowerJoinCaches()
368388 };
369389 }
370390
371- public static function getAliasFor ($ relationName = null )
391+ public static function getAliasFor ($ model = null , $ default = null )
372392 {
373- return JoinRelationship::$ powerJoinAliasesCache [$ relationName ] ?? null ;
393+ return JoinRelationship::$ powerJoinAliasesCache [spl_object_id ( $ model ) ] ?? $ default ;
374394 }
375395}
Original file line number Diff line number Diff line change @@ -271,7 +271,7 @@ public function getFarParent()
271271 public function getTableOrAliasForModel ()
272272 {
273273 return function ($ model , $ default = null ) {
274- return JoinRelationship::$ powerJoinAliasesCache [ spl_object_id ($ model)] ?? $ default ;
274+ return JoinRelationship::getAliasFor ($ model, $ default) ;
275275 };
276276 }
277277}
You can’t perform that action at this time.
0 commit comments