public function bulkDelete(Request $request)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('Categories', 'delete')) {
            return $this->noPermission();
        }

        // if there are no item selected
        if (count($request->all()) <= 0) {
            return $this->response('Please select items to be deleted', 500);
        }

        // loop throw the items
        foreach ($request->all() as $id) {
            $categoryDeleteRes = $this->deleteCategory($id);
            if(gettype($categoryDeleteRes) == "boolean") {
                if(!$categoryDeleteRes) {
                    return $this->response('Category could not be deleted.', 500);
                }
            }else{
                return $categoryDeleteRes;
            }
        }

        return $this->response('Selected categories are successfully deleted');
    }
public function bulkDelete(Request $request)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('Categories', 'delete')) {
            return $this->noPermission();
        }

        // if there are no item selected
        if (count($request->all()) <= 0) {
            return $this->response('Please select items to be deleted', 500);
        }

        // loop throw the items
        foreach ($request->all() as $id) {
            $categoryDeleteRes = $this->deleteCategory($id);
            if(gettype($categoryDeleteRes) == "boolean") {
                if(!$categoryDeleteRes) {
                    return $this->response('Category could not be deleted.', 500);
                }
            }else{
                return $categoryDeleteRes;
            }
        }

        return $this->response('Selected categories are successfully deleted');
    }
public function bulkDelete ( Request $ request ) { // check if user has permissions to access this link if ( ! User :: hasAccess ( 'Categories' , 'delete' ) ) { return $ this -> noPermission ( ) ; } // if there are no item selected if ( count ( $ request -> all ( ) ) <= 0 ) { return $ this -> response ( 'Please select items to be deleted' , 500 ) ; } // loop throw the items foreach ( $ request -> all ( ) as $ id ) { $ categoryDeleteRes = $ this -> deleteCategory ( $ id ) ; if ( gettype ( $ categoryDeleteRes ) == "boolean" ) { if ( ! $ categoryDeleteRes ) { return $ this -> response ( 'Category could not be deleted.' , 500 ) ; } } else { return $ categoryDeleteRes ; } } return $ this -> response ( 'Selected categories are successfully deleted' ) ; }
Bulk Delete categories, Delete many categories in one request.

@param  Request $request
@return array|bool
@throws \Exception
Bulk Delete categories Delete many categories in one request .