Exemple #1
0
 public function index_onDelete()
 {
     if (($checkedIds = post('checked')) && is_array($checkedIds) && count($checkedIds)) {
         foreach ($checkedIds as $postId) {
             if (!($post = \Zingabory\Gallery\Models\Gallery::find($postId))) {
                 continue;
             }
             $post->delete();
         }
         Flash::success('Supprimé avec succès');
     }
     return $this->listRefresh();
 }
Exemple #2
0
 protected function loadGallery()
 {
     $slug = $this->property('slug');
     $gallery = GalleryModel::where('slug', $slug)->first();
     /*
      * Add a "url" helper attribute for linking to each category
      */
     if ($gallery && $gallery->categories->count()) {
         $gallery->categories->each(function ($category) {
             $category->setUrl($this->categoryPage, $this->controller);
         });
     }
     return $gallery;
 }
 protected function listGalleries()
 {
     $categories = $this->category ? $this->category->id : null;
     /*
      * List all the galleries, eager load their categories
      */
     $galleries = GalleryModel::with('categories')->listFrontEnd(['page' => $this->property('pageNumber'), 'perPage' => $this->property('galleriesPerPage'), 'categories' => $categories]);
     /*
      * Add a "url" helper attribute for linking to each gallery and category
      */
     $galleries->each(function ($gallery) {
         $gallery->setUrl($this->galleryPage, $this->controller);
         $gallery->categories->each(function ($category) {
             $category->setUrl($this->categoryPage, $this->controller);
         });
     });
     return $galleries;
 }