コード例 #1
0
 public function multidelete()
 {
     $id = Input::get('id');
     $do = new Page();
     $list = $do->whereIn('id', $id)->delete();
     if ($list) {
         return Redirect::back()->withErrors(Null);
     } else {
         return Redirect::back()->withInput()->withErrors('Page delete fail!');
     }
 }
コード例 #2
0
 /**
  * Display the subtree of a category.
  *
  * @param  int  $id
  * @return Response
  */
 public function show($id)
 {
     // Make sure resource exists
     $this->resource = $this->resource->findOrFail($id);
     $this->subtitle = $this->resource;
     // Get subcategories
     $subcategories = $this->resource->getDescendants();
     // Get pages this category
     $pages = $this->resource->pages()->orderBy('name')->get();
     // Get pages of subcategories
     $subpages = Page::whereIn('category_id', $subcategories->lists('id'))->orderBy('name')->get();
     // Function to render a tree node
     $render = function (array $node) {
         return link_to_route('category.show', $node['name'], [$node['id']]);
     };
     // Build subcategories tree
     $tree = tree($subcategories->toHierarchy()->toArray(), $render);
     view()->share(compact('pages', 'subpages', 'subcategories', 'tree'));
     return parent::show($id);
 }
コード例 #3
0
 public function deleteByIds($ids)
 {
     $result = Page::whereIn('id', $ids)->delete();
     return $result;
 }