Beispiel #1
0
 public function delete($identifiers)
 {
     $posts = Post::whereNotIn('identifier', $identifiers)->where('type', $this->type)->where('status', '<>', 'deleted')->get();
     Post::whereIn('id', $posts->lists('id')->toArray())->update(['status' => 'deleted']);
     foreach ($posts as $p) {
         echo 'Removed ' . ucfirst($this->type) . ': ' . $p->identifier . "\n";
     }
 }
Beispiel #2
0
 public static function delete($redirects, $post)
 {
     $posts = Post::whereNotIn('slug', $redirects)->where('type', 'redirect')->where('meta', 'LIKE', '%"redirect_to":"' . str_replace('/', "\\\\/", $post->slug) . '"%')->get();
     if (!$posts->isEmpty()) {
         Post::whereIn('id', $posts->lists('id')->toArray())->delete();
         foreach ($posts as $p) {
             echo 'Removed Redirect: ' . $p->slug . "\n";
         }
     }
 }
Beispiel #3
0
 public static function count()
 {
     return Post::where('published_at', '<>', 'NULL')->where('type', 'post')->where('status', 'active')->count();
 }