Serverfireteam\Panel\Link::allCached PHP Method

allCached() public static method

public static allCached ( $forceRefresh = false )
    public static function allCached($forceRefresh = false)
    {
        if (!isset(self::$cache['all']) || $forceRefresh) {
            self::$cache['all'] = Link::all();
        }
        return self::$cache['all'];
    }

Usage Example

Example #1
0
 public static function create()
 {
     self::$urls = \Config::get('panel.panelControllers');
     $config = \Serverfireteam\Panel\Link::allCached();
     $dashboard = array();
     $appHelper = new AppHelper();
     // Make Dashboard Items
     foreach ($config as $value) {
         $modelName = $value['url'];
         if (in_array($modelName, self::$urls)) {
             $model = "Serverfireteam\\Panel\\" . $modelName;
         } else {
             $model = $appHelper->getNameSpace() . $modelName;
         }
         //if (class_exists($value)) {
         if ($value['show_menu']) {
             $user = \Auth::guard('panel')->user();
             if (!$user->hasRole('super')) {
                 if (!\Auth::guard('panel')->user()->hasPermission($modelName . 'all')) {
                     continue;
                 }
             }
             $dashboard[] = array('modelName' => $modelName, 'title' => $value['display'], 'count' => $model::count(), 'showListUrl' => 'panel/' . $modelName . '/all', 'addUrl' => 'panel/' . $modelName . '/edit');
         }
     }
     return $dashboard;
 }
All Usage Examples Of Serverfireteam\Panel\Link::allCached