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

        DB::statement('SET FOREIGN_KEY_CHECKS=0');
        $group = \App\Models\UserGroup::find($id)->delete();
        if($group) {
            DB::table('permissions')->where('groupID', $id)->delete();
            $result = $this->response('Group is deleted');
        }else{
            $result = $this->response('Internal server error. Please try again later', 500);
        }
        return $result;
    }
public function delete($lang, $id)
    {
        // check if user has permissions to access this link
        if(!User::hasAccess('Permissions', 'delete')) {
            return $this->noPermission();
        }

        DB::statement('SET FOREIGN_KEY_CHECKS=0');
        $group = \App\Models\UserGroup::find($id)->delete();
        if($group) {
            DB::table('permissions')->where('groupID', $id)->delete();
            $result = $this->response('Group is deleted');
        }else{
            $result = $this->response('Internal server error. Please try again later', 500);
        }
        return $result;
    }
public function delete ( $ lang , $ id ) { // check if user has permissions to access this link if ( ! User :: hasAccess ( 'Permissions' , 'delete' ) ) { return $ this -> noPermission ( ) ; } DB :: statement ( 'SET FOREIGN_KEY_CHECKS=0' ) ; $ group = \ App \ Models \ UserGroup :: find ( $ id ) -> delete ( ) ; if ( $ group ) { DB :: table ( 'permissions' ) -> where ( 'groupID' , $ id ) -> delete ( ) ; $ result = $ this -> response ( 'Group is deleted' ) ; } else { $ result = $ this -> response ( 'Internal server error. Please try again later' , 500 ) ; } return $ result ; }
Delete a group and it's permissions by it's ID.

@param  string $lang
@param  int    $id
@return array
Delete a group and it s permissions by it s ID .