public function delete($lang, $id)
    {
        if(!User::hasAccess('CustomField', 'delete')) {
            return $this->noPermission();
        }
        $customFieldGroup = CustomFieldGroup::find($id);

        if($customFieldGroup) {
            $fields = CustomField::where('customFieldGroupID', $id);
            if($fields) {
                $fields->delete();
                $customFieldGroup->delete();

                return $this->response('Custom field group is deleted');
            }
        }

        return $this->response('Custom field group could not be deleted. Please try again later', 500);
    }
public function delete($lang, $id)
    {
        if(!User::hasAccess('CustomField', 'delete')) {
            return $this->noPermission();
        }
        $customFieldGroup = CustomFieldGroup::find($id);

        if($customFieldGroup) {
            $fields = CustomField::where('customFieldGroupID', $id);
            if($fields) {
                $fields->delete();
                $customFieldGroup->delete();

                return $this->response('Custom field group is deleted');
            }
        }

        return $this->response('Custom field group could not be deleted. Please try again later', 500);
    }
public function delete ( $ lang , $ id ) { if ( ! User :: hasAccess ( 'CustomField' , 'delete' ) ) { return $ this -> noPermission ( ) ; } $ customFieldGroup = CustomFieldGroup :: find ( $ id ) ; if ( $ customFieldGroup ) { $ fields = CustomField :: where ( 'customFieldGroupID' , $ id ) ; if ( $ fields ) { $ fields -> delete ( ) ; $ customFieldGroup -> delete ( ) ; return $ this -> response ( 'Custom field group is deleted' ) ; } } return $ this -> response ( 'Custom field group could not be deleted. Please try again later' , 500 ) ; }
Delete a custom field group from database.

@param string  $lang language slug
@param integer $id   custom fields group ID

@return array ErrorHandler response
Delete a custom field group from database .