Пример #1
0
 protected function listAds()
 {
     $categories = $this->category ? $this->category->id : null;
     $ads = Ad::with('category')->listFrontEnd(['page' => $this->propertyOrParam('pageParam'), 'sort' => $this->property('AdOrderAttr'), 'perPage' => $this->property('AdsPerPage'), 'categories' => $categories]);
     $ads->each(function ($ad) {
         $ad->setUrl($this->adPage, $this->controller);
         //$ad->categories->each(function ($category) {
         //    $category->setUrl($this->categoryPage, $this->controller);
         //});
     });
     return $ads;
 }