File tree Expand file tree Collapse file tree 1 file changed +13
-17
lines changed
src/Darryldecode/Backend/Components/ContentBuilder/Models Expand file tree Collapse file tree 1 file changed +13
-17
lines changed Original file line number Diff line number Diff line change @@ -149,29 +149,25 @@ public function revisions()
149149 return $ this ->hasMany ('Darryldecode\Backend\Components\ContentBuilder\Models\ContentRevisions ' ,'content_id ' );
150150 }
151151
152- /**
153- * Scope for start date
154- *
155- * @param $query
156- * @param $startDate
157- * @return bool
158- */
152+ // SCOPES
159153 public function scopeOfStartDate ($ query , $ startDate )
160154 {
161- if ( $ startDate === false ) return false ;
155+ if ( $ startDate === false || $ startDate === null ) return false ;
162156 return $ query ->where ('created_at ' ,'>= ' ,$ startDate );
163157 }
164-
165- /**
166- * scope for end date
167- *
168- * @param $query
169- * @param $endDate
170- * @return bool
171- */
172158 public function scopeOfEndDate ($ query , $ endDate )
173159 {
174- if ( $ endDate === false ) return false ;
160+ if ( $ endDate === false || $ endDate === null ) return false ;
175161 return $ query ->where ('created_at ' ,'<= ' ,$ endDate );
176162 }
163+ public function scopeOfTitle ($ query , $ title )
164+ {
165+ if ( $ title === false || $ title === null ) return false ;
166+ return $ query ->where ('title ' ,'LIKE ' ,"% {$ title }% " );
167+ }
168+ public function scopeOfSlug ($ query , $ slug )
169+ {
170+ if ( $ slug === false || $ slug === null ) return false ;
171+ return $ query ->where ('slug ' ,'>= ' ,$ slug );
172+ }
177173}
You can’t perform that action at this time.
0 commit comments