/**
  * Find links for the current user based on their recent tags, excluding any they added themselves
  *
  * @param DiscoverCacheHandler $discoverHandler
  * @param TagRepositoryInterface $userTagRepo
  * @param TagHandlerInterface $tagHandler
  * @param CacheHandlerInterface $cacheHandler
  * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
  */
 public function discover(DiscoverCacheHandler $discoverHandler, TagRepositoryInterface $userTagRepo, TagHandlerInterface $tagHandler, CacheHandlerInterface $cacheHandler)
 {
     // Get specified tag from GET
     $tags = request()->get('tags');
     $tagsArray = [];
     if ($tags) {
         // Convert tags string into array and clean the tag names
         $tagsArray = explode(' ', $tags);
         foreach ($tagsArray as $key => $tag) {
             $tagsArray[$key] = str_replace('_', ' ', $tag);
         }
         // Get discovered items for tag
         $items = $discoverHandler->getLinksForUser($userTagRepo, $tagHandler, $cacheHandler, $tagsArray);
     } else {
         // Get all discovered items
         $items = $discoverHandler->getLinksForUser($userTagRepo, $tagHandler, $cacheHandler);
     }
     $title = "Discover";
     return view('discover', ['items' => $items, 'title' => $title, 'tags' => $tagsArray]);
 }
Beispiel #2
0
 public function test(DiscoverCacheHandler $discoverCacheHandler, ImageHandlerInterface $imageHandler, CacheHandlerInterface $cacheHandler, SearchHandlerInterface $searchHandler)
 {
     $generate = new GenerateThumbnails();
     $generate->handle($imageHandler, $cacheHandler, $searchHandler);
     $discoverCacheHandler->generateAll($searchHandler, $cacheHandler);
 }
 /**
  * Execute the console command.
  *
  * @param DiscoverCacheHandler $discoverCacheHandler
  * @param SearchHandlerInterface $searchHandler
  * @param CacheHandlerInterface $cacheHandler
  * @return mixed
  */
 public function handle(DiscoverCacheHandler $discoverCacheHandler, SearchHandlerInterface $searchHandler, CacheHandlerInterface $cacheHandler)
 {
     $discoverCacheHandler->generateAll($searchHandler, $cacheHandler);
 }