Example #1
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function destroy($id)
 {
     //
     if (!Entrust::can('category-delete')) {
         $this->data['category'] = Category::getNested();
         return view('backend.category.lists', $this->data);
     }
     $category = Category::find($id);
     if ($category->delete()) {
         $category->where('parent', $id)->update(['parent' => 0]);
         $this->data['category'] = Category::getNested();
         return view('backend.category.lists', $this->data);
     }
 }