예제 #1
0
파일: Page.php 프로젝트: artemsk/veer-core
 /**
  * Query Builder: 
  * 
  * - who: Many Pages
  * - with: Images
  * - to whom: make() | page/{blank}
  */
 public function getPagesWithSite($siteId, $queryParams = array())
 {
     return \Veer\Models\Page::whereHas('categories', function ($q) use($siteId) {
         $q->where('sites_id', '=', $siteId);
     })->excludeHidden()->orderBy(array_get($queryParams, 'sort', 'created_at'), array_get($queryParams, 'direction', 'desc'))->take(array_get($queryParams, 'take_pages', 15))->skip(array_get($queryParams, 'skip_pages', 0))->with(array('images' => function ($query) {
         $query->orderBy('pivot_id', 'asc');
     }), 'categories')->get();
 }
예제 #2
0
 protected function getPages($category, $queueCategory)
 {
     return \Veer\Models\Page::whereHas('categories', function ($q) use($category) {
         $q->where(function ($query) use($category) {
             $query->where('categories_id', '=', $category);
         });
     })->whereHas('categories', function ($q) use($queueCategory) {
         $q->where(function ($query) use($queueCategory) {
             $query->where('categories_id', '=', $queueCategory);
         });
     })->with(array('images' => function ($query) {
         $query->orderBy('pivot_id', 'asc');
     }))->sitevalidation(app('veer')->siteId)->where('hidden', '=', 1)->orderBy('manual_order', 'asc')->orderBy('created_at', 'asc')->take($this->number_of_items)->select('id', 'url', 'title', 'small_txt', 'views', 'created_at', 'users_id', 'hidden')->get();
 }