예제 #1
0
 /**
  * @param HelpInterface $help
  * @param               $route
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function show(HelpInterface $help, $route)
 {
     $content = ['text' => '<p>There is no help for this route!</p>', 'title' => 'Help'];
     if (!$help->hasRoute($route)) {
         Log::error('No such route: ' . $route);
         return Response::json($content);
     }
     if ($help->inCache($route)) {
         $content = ['text' => $help->getFromCache('help.' . $route . '.text'), 'title' => $help->getFromCache('help.' . $route . '.title')];
         return Response::json($content);
     }
     $content = $help->getFromGithub($route);
     $help->putInCache($route, $content);
     return Response::json($content);
 }
예제 #2
0
 /**
  * @param HelpInterface $help
  * @param               $route
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function show(HelpInterface $help, string $route)
 {
     $language = Preferences::get('language', config('firefly.default_language', 'en_US'))->data;
     $content = ['text' => '<p>' . strval(trans('firefly.route_has_no_help')) . '</p>', 'title' => 'Help'];
     if (!$help->hasRoute($route)) {
         Log::error('No such route: ' . $route);
         return Response::json($content);
     }
     if ($help->inCache($route)) {
         $content = ['text' => $help->getFromCache('help.' . $route . '.text.' . $language), 'title' => $help->getFromCache('help.' . $route . '.title.' . $language)];
         return Response::json($content);
     }
     $content = $help->getFromGithub($language, $route);
     $help->putInCache($route, $language, $content);
     return Response::json($content);
 }