private function checkMediaItemsForReindex() { // check for media items which which should be reindexed because their accessibiliy has changed $mediaItemsToReindex = MediaItem::upToDateInIndex()->where(function ($q) { $q->where(function ($q) { $q->accessible()->where("in_index", false); })->orWhere(function ($q) { $q->notAccessible()->where("in_index", true); }); })->get(); foreach ($mediaItemsToReindex as $a) { // touching will increment the version number $a->touch(); $this->info("Media item with id " . $a->id . " queued for reindex."); } }