예제 #1
0
 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request $request
  * @param  \Closure                 $next
  * @return mixed
  */
 public function handle($request, \Closure $next)
 {
     $locale = $this->request->segment(1) ?: App::getLocale();
     $item = $this->menuItem->findByUriInLanguage($this->request->segment(2), $locale);
     if ($this->isOffline($item)) {
         App::abort(404);
     }
     return $next($request);
 }
예제 #2
0
 /**
  * @param  string $uri
  * @param  string $locale
  * @return object
  */
 public function findByUriInLanguage($uri, $locale)
 {
     return $this->cache->tags($this->entityName, 'global')->remember("{$this->locale}.{$this->entityName}.findByUriInLanguage.{$uri}.{$locale}", $this->cacheTime, function () use($uri, $locale) {
         return $this->repository->findByUriInLanguage($uri, $locale);
     });
 }