File tree Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Expand file tree Collapse file tree 2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -30,6 +30,20 @@ public function index(Request $request)
3030 $ statuslabels = $ statuslabels ->TextSearch ($ request ->input ('search ' ));
3131 }
3232
33+
34+ // if a status_type is passed, filter by that
35+ if ($ request ->filled ('status_type ' )) {
36+ if (strtolower ($ request ->input ('status_type ' ))== 'pending ' ) {
37+ $ statuslabels = $ statuslabels ->Pending ();
38+ } elseif (strtolower ($ request ->input ('status_type ' ))== 'archived ' ) {
39+ $ statuslabels = $ statuslabels ->Archived ();
40+ } elseif (strtolower ($ request ->input ('status_type ' ))== 'deployable ' ) {
41+ $ statuslabels = $ statuslabels ->Deployable ();
42+ } elseif (strtolower ($ request ->input ('status_type ' ))== 'undeployable ' ) {
43+ $ statuslabels = $ statuslabels ->Undeployable ();
44+ }
45+ }
46+
3347 // Set the offset to the API call's offset, unless the offset is higher than the actual count of items in which
3448 // case we override with the actual count, so we should return 0 items.
3549 $ offset = (($ statuslabels ) && ($ request ->get ('offset ' ) > $ statuslabels ->count ())) ? $ statuslabels ->count () : $ request ->get ('offset ' , 0 );
Original file line number Diff line number Diff line change @@ -120,6 +120,18 @@ public function scopeDeployable()
120120 ->where ('deployable ' , '= ' , 1 );
121121 }
122122
123+ /**
124+ * Query builder scope for undeployable status types
125+ *
126+ * @return \Illuminate\Database\Query\Builder Modified query builder
127+ */
128+ public function scopeUndeployable ()
129+ {
130+ return $ this ->where ('pending ' , '= ' , 0 )
131+ ->where ('archived ' , '= ' , 0 )
132+ ->where ('deployable ' , '= ' , 0 );
133+ }
134+
123135 /**
124136 * Helper function to determine type attributes
125137 *
You can’t perform that action at this time.
0 commit comments