@@ -146,39 +146,40 @@ public function index(Request $request)
146146 $ assets ->withTrashed ()->Deleted ();
147147 break ;
148148 case 'Pending ' :
149- $ assets ->join ('status_labels ' ,function ($ join ) {
150- $ join ->on ('status_labels .id ' , "= " , "assets.status_id " )
151- ->where ('status_labels .deployable ' ,'= ' ,0 )
152- ->where ('status_labels .pending ' ,'= ' ,1 )
153- ->where ('status_labels .archived ' , '= ' , 0 );
149+ $ assets ->join ('status_labels AS status_alias ' ,function ($ join ) {
150+ $ join ->on ('status_alias .id ' , "= " , "assets.status_id " )
151+ ->where ('status_alias .deployable ' ,'= ' ,0 )
152+ ->where ('status_alias .pending ' ,'= ' ,1 )
153+ ->where ('status_alias .archived ' , '= ' , 0 );
154154 });
155155 break ;
156156 case 'RTD ' :
157- $ assets ->join ('status_labels ' ,function ($ join ) {
158- $ join ->on ('status_labels.id ' , "= " , "assets.status_id " )
159- ->where ('status_labels.deployable ' ,'= ' ,1 )
160- ->where ('status_labels.pending ' ,'= ' ,0 )
161- ->where ('status_labels.archived ' , '= ' , 0 );
157+ $ assets ->whereNull ('assets.assigned_to ' )
158+ ->join ('status_labels AS status_alias ' ,function ($ join ) {
159+ $ join ->on ('status_alias.id ' , "= " , "assets.status_id " )
160+ ->where ('status_alias.deployable ' ,'= ' ,1 )
161+ ->where ('status_alias.pending ' ,'= ' ,0 )
162+ ->where ('status_alias.archived ' , '= ' , 0 );
162163 });
163164 break ;
164165 case 'Undeployable ' :
165166 $ assets ->Undeployable ();
166167 break ;
167168 case 'Archived ' :
168- $ assets ->join ('status_labels ' ,function ($ join ) {
169- $ join ->on ('status_labels .id ' , "= " , "assets.status_id " )
170- ->where ('status_labels .deployable ' ,'= ' ,0 )
171- ->where ('status_labels .pending ' ,'= ' ,0 )
172- ->where ('status_labels .archived ' , '= ' , 1 );
169+ $ assets ->join ('status_labels AS status_alias ' ,function ($ join ) {
170+ $ join ->on ('status_alias .id ' , "= " , "assets.status_id " )
171+ ->where ('status_alias .deployable ' ,'= ' ,0 )
172+ ->where ('status_alias .pending ' ,'= ' ,0 )
173+ ->where ('status_alias .archived ' , '= ' , 1 );
173174 });
174175 break ;
175176 case 'Requestable ' :
176177 $ assets ->where ('assets.requestable ' , '= ' , 1 )
177- ->join ('status_labels ' ,function ($ join ) {
178- $ join ->on ('status_labels .id ' , "= " , "assets.status_id " )
179- ->where ('status_labels .deployable ' ,'= ' ,1 )
180- ->where ('status_labels .pending ' ,'= ' ,0 )
181- ->where ('status_labels .archived ' , '= ' , 0 );
178+ ->join ('status_labels AS status_alias ' ,function ($ join ) {
179+ $ join ->on ('status_alias .id ' , "= " , "assets.status_id " )
180+ ->where ('status_alias .deployable ' ,'= ' ,1 )
181+ ->where ('status_alias .pending ' ,'= ' ,0 )
182+ ->where ('status_alias .archived ' , '= ' , 0 );
182183 });
183184
184185 break ;
@@ -188,9 +189,9 @@ public function index(Request $request)
188189 break ;
189190 default :
190191 // terrible workaround for complex-query Laravel bug in fulltext
191- $ assets ->join ('status_labels ' ,function ($ join ) {
192- $ join ->on ('status_labels .id ' , "= " , "assets.status_id " )
193- ->where ('status_labels .archived ' , '= ' , 0 );
192+ $ assets ->join ('status_labels AS status_alias ' ,function ($ join ) {
193+ $ join ->on ('status_alias .id ' , "= " , "assets.status_id " )
194+ ->where ('status_alias .archived ' , '= ' , 0 );
194195 });
195196 }
196197
0 commit comments