Serverfireteam\Panel\Link::getMainUrls PHP Method

getMainUrls() public static method

public static getMainUrls ( $forceRefresh = false )
    public static function getMainUrls($forceRefresh = false)
    {
        if (!isset(self::$cache['main_urls']) || $forceRefresh) {
            $configs = Link::where('main', '=', true)->get(['url']);
            self::$cache['main_urls'] = $configs->pluck('url')->toArray();
        }
        return self::$cache['main_urls'];
    }

Usage Example

Example #1
0
 public function entityUrl($entity, $methods)
 {
     $appHelper = new libs\AppHelper();
     $urls = Link::getMainUrls();
     if (in_array($entity, $urls)) {
         $controller_path = 'Serverfireteam\\Panel\\' . $entity . 'Controller';
     } else {
         $panel_path = \Config::get('panel.controllers');
         if (isset($panel_path)) {
             $controller_path = '\\' . $panel_path . '\\' . $entity . 'Controller';
         } else {
             $controller_path = $appHelper->getNameSpace() . 'Http\\Controllers\\' . $entity . 'Controller';
         }
     }
     try {
         $controller = \App::make($controller_path);
     } catch (\Exception $ex) {
         throw new \Exception("Can not found the Controller ( {$controller_path} ) ");
     }
     if (!method_exists($controller, $methods)) {
         throw new \Exception('Controller does not implement the CrudController methods!');
     } else {
         return $controller->callAction($methods, array('entity' => $entity));
     }
 }
All Usage Examples Of Serverfireteam\Panel\Link::getMainUrls