public function bulkDelete(Request $request)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('CustomField', 'delete')) {
            return $this->noPermission();
        }
        $data = $request->all();
        foreach ($data as $id){
            $customFieldsGroup = CustomFieldGroup::find($id)->delete();
            if (!$customFieldsGroup) {
                return $this->response('Internal server error. Please try again later', 500);
            }else{
                CustomField::where('customFieldGroupID', $id)->delete();
                // TODO me i fshi vlerat e custom fildave neper poste, users dhe category
            }
        }
        return $this->response('Custom fields groups are deleted');
    }
public function bulkDelete(Request $request)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('CustomField', 'delete')) {
            return $this->noPermission();
        }
        $data = $request->all();
        foreach ($data as $id){
            $customFieldsGroup = CustomFieldGroup::find($id)->delete();
            if (!$customFieldsGroup) {
                return $this->response('Internal server error. Please try again later', 500);
            }else{
                CustomField::where('customFieldGroupID', $id)->delete();
                // TODO me i fshi vlerat e custom fildave neper poste, users dhe category
            }
        }
        return $this->response('Custom fields groups are deleted');
    }
public function bulkDelete ( Request $ request ) { // check if user has permissions to access this link if ( ! User :: hasAccess ( 'CustomField' , 'delete' ) ) { return $ this -> noPermission ( ) ; } $ data = $ request -> all ( ) ; foreach ( $ data as $ id ) { $ customFieldsGroup = CustomFieldGroup :: find ( $ id ) -> delete ( ) ; if ( ! $ customFieldsGroup ) { return $ this -> response ( 'Internal server error. Please try again later' , 500 ) ; } else { CustomField :: where ( 'customFieldGroupID' , $ id ) -> delete ( ) ; // TODO me i fshi vlerat e custom fildave neper poste, users dhe category } } return $ this -> response ( 'Custom fields groups are deleted' ) ; }
Bulk Delete custom fields groups and their custom fields.

@param  Request $request array of custom fields IDs
@return array ErrorHandler response
Bulk Delete custom fields groups and their custom fields .