Пример #1
0
 public function show($id, $callback = null)
 {
     if (is_null($callback)) {
         $callback = function (&$model, $host) {
             $model = $model->with('items');
         };
     }
     $list = parent::show($id, $callback);
     $host = $this;
     $list->items->each(function ($item) use($host) {
         $host->setCollectionItemLinks($item);
     });
     return $list;
 }
Пример #2
0
 public function show($id, $callback = null)
 {
     if (is_null($callback)) {
         $callback = function (&$model, $host) {
             $model = $model->where('content_type', '=', $host->getContentType())->where('lang', '=', $host->getLocale())->with(array('contentmetas', 'categories'));
             if ($host->is_guest()) {
                 $model = $model->where('status', '=', 'published');
             } else {
                 if (!$host->is_moderator()) {
                     $model = $model->where('author_id', '=', $host->getAuthorId());
                 }
             }
         };
     }
     $item = parent::show($id, $callback);
     if ($item) {
         $this->prepareContentItem($item);
     }
     return $item;
 }