| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 | 
							- <?php
 
- namespace App\Repositories;
 
- use App\Models\Navigation;
 
- use Prettus\Repository\Eloquent\BaseRepository;
 
- use Illuminate\Support\Facades\Cache;
 
- /**
 
-  * Class ArticleRepositoryEloquent.
 
-  *
 
-  * @package namespace App\Repositories;
 
-  */
 
- class NavigationRepository extends BaseRepository
 
- {
 
-     public function model()
 
-     {
 
-         return Navigation::class;
 
-     }
 
-     public function getNav($where)
 
-     {
 
-         return $this->model->where($where)->first();
 
-     }
 
-     public function getTopNavs($where)
 
-     {
 
-         return $this->model->where($where)->orderBy('order', 'asc')->get();
 
-     }
 
-     public function getNavs()
 
-     {
 
-         //Cache::forget('nav_list');
 
-        //Cache::flush();
 
-         if (null === $nav_list =  Cache::get('nav_list')) {
 
-             $navs = $this->model->select('alias', 'title', 'urltype', 'pagealias', 'tag', 'target', 'color', 'order', 'url', 'is_personal')
 
-                                  ->where(array('display'=>'1'))
 
-                                  ->orderBy('order', 'asc')
 
-                                  ->get();
 
-             $nav_list = array();
 
-             foreach ($navs as $val) {
 
-                 $k = $val->alias;
 
-                 if ($val->color) {
 
-                     $val->title = "<font color='".$val->color."'>".$val->title."</font>";
 
-                 }
 
-                 $nav_list[$k][] = $val;
 
-             }
 
-             Cache::forever('nav_list', $nav_list);
 
-         }
 
-         return $nav_list;
 
-     }
 
- }
 
 
  |