public function index($communityId) { $items = []; $galleryInstance = Gallery\GalleryInstance::where('community_id', '=', $communityId)->where('gallery_id', '=', 1)->first(); if (!is_null($galleryInstance)) { $items = Gallery\GalleryItem::where('gallery_instance_id', '=', $galleryInstance->id)->get(); } return $items; }
protected function setParams() { $galleryInstance = \App\RExpress\Models\Gallery\GalleryInstance::where('gallery_id', '=', $this->options['galleryId'])->where('community_id', '=', $this->community->iCommunityId)->first(); if (is_object($galleryInstance)) { $galleryItems = \App\RExpress\Models\Gallery\GalleryItem::where('gallery_instance_id', '=', $galleryInstance->id)->get(); $this->params = ['community' => $this->community, 'options' => $this->options, 'galleryInstanceId' => $galleryInstance->id, 'galleryItems' => $galleryItems]; } else { $this->params = ['community' => $this->community, 'options' => $this->options, 'galleryInstanceId' => '', 'galleryItems' => []]; } }