app/Http/Controllers/Backend/BackendCategoryController.php
/**
     * Show the form with options for delete the specified resource.
     *
     * @param  int  $id
     * @return \Illuminate\Http\Response
     */
Show the form with options for delete the specified resource.
@param  int  $id
@return \Illuminate\Http\Response
Show the form with options for delete the specified resource . @param int $id @return \ Illuminate \ Http \ Response
public function delete($id)
    {
        $category = Category::findOrFail($id);
            $has_sub_category = $category->children()->count();
            $has_posts = $category->posts()->count();
        $categories_tree = $this->categories->listTreeCategories(0,$id);
        $categories_available = $this->categories->linearizeCategoryArray($categories_tree);
        return view( 'backend.categories.delete', compact('category', 'has_sub_category', 'has_posts', 'categories_available') );
    }
public function delete ( $ id ) { $ category = Category :: findOrFail ( $ id ) ; $ has_sub_category = $ category -> children ( ) -> count ( ) ; $ has_posts = $ category -> posts ( ) -> count ( ) ; $ categories_tree = $ this -> categories -> listTreeCategories ( 0 , $ id ) ; $ categories_available = $ this -> categories -> linearizeCategoryArray ( $ categories_tree ) ; return view ( 'backend.categories.delete' , compact ( 'category' , 'has_sub_category' , 'has_posts' , 'categories_available' ) ) ; }
Show the form with options for delete the specified resource.
Show the form with options for delete the specified resource .
//Check some point // 1) Did The Category selected has sub-categories?
 // If it has, so I need to ask to user what they want to do with subfolder (delete, Move) //2) Did the category selected has post?
 //If it has,  so I need to ask to user what they want to do with Posts (delete, Move) // Get all Category tree except the category branch and its related sub category // Linearize in array