public function putShow($groupId)
    {
        $groupname = Input::get('groupname');
        $permissions = array();

        $errors = $this->_validateGroup(Input::get('permission'), $groupname, $permissions);
        if(!empty($errors)) {
            return Response::json(array('groupUpdated' => false, 'errorMessages' => $errors));
        } else {
            try {
                $group = Sentry::getGroupProvider()->findById($groupId);
                $group->name = $groupname;
                $group->permissions = $permissions;

                $permissions = (empty($permissions)) ? '' : json_encode($permissions);
                // delete permissions in db
                DB::table('groups')
                    ->where('id', $groupId)
                    ->update(array('permissions' => $permissions));

                if($group->save()) {
                    return Response::json(array('groupUpdated' => true, 'message' => trans('syntara::groups.messages.success'), 'messageType' => 'success'));
                } else {
                    return Response::json(array('groupUpdated' => false, 'message' => trans('syntara::groups.messages.try'), 'messageType' => 'danger'));
                }
            } catch (\Cartalyst\Sentry\Groups\NameRequiredException $e) {} catch (\Cartalyst\Sentry\Groups\GroupExistsException $e) {
                return Response::json(array('groupUpdated' => false, 'message' => trans('syntara::groups.messages.exists'), 'messageType' => 'danger'));
            }
        }
    }
public function putShow($groupId)
    {
        $groupname = Input::get('groupname');
        $permissions = array();

        $errors = $this->_validateGroup(Input::get('permission'), $groupname, $permissions);
        if(!empty($errors)) {
            return Response::json(array('groupUpdated' => false, 'errorMessages' => $errors));
        } else {
            try {
                $group = Sentry::getGroupProvider()->findById($groupId);
                $group->name = $groupname;
                $group->permissions = $permissions;

                $permissions = (empty($permissions)) ? '' : json_encode($permissions);
                // delete permissions in db
                DB::table('groups')
                    ->where('id', $groupId)
                    ->update(array('permissions' => $permissions));

                if($group->save()) {
                    return Response::json(array('groupUpdated' => true, 'message' => trans('syntara::groups.messages.success'), 'messageType' => 'success'));
                } else {
                    return Response::json(array('groupUpdated' => false, 'message' => trans('syntara::groups.messages.try'), 'messageType' => 'danger'));
                }
            } catch (\Cartalyst\Sentry\Groups\NameRequiredException $e) {} catch (\Cartalyst\Sentry\Groups\GroupExistsException $e) {
                return Response::json(array('groupUpdated' => false, 'message' => trans('syntara::groups.messages.exists'), 'messageType' => 'danger'));
            }
        }
    }
public function putShow ( $ groupId ) { $ groupname = Input :: get ( 'groupname' ) ; $ permissions = array ( ) ; $ errors = $ this -> _validateGroup ( Input :: get ( 'permission' ) , $ groupname , $ permissions ) ; if ( ! empty ( $ errors ) ) { return Response :: json ( array ( 'groupUpdated' => false , 'errorMessages' => $ errors ) ) ; } else { try { $ group = Sentry :: getGroupProvider ( ) -> findById ( $ groupId ) ; $ group -> name = $ groupname ; $ group -> permissions = $ permissions ; $ permissions = ( empty ( $ permissions ) ) ? '' : json_encode ( $ permissions ) ; // delete permissions in db DB :: table ( 'groups' ) -> where ( 'id' , $ groupId ) -> update ( array ( 'permissions' => $ permissions ) ) ; if ( $ group -> save ( ) ) { return Response :: json ( array ( 'groupUpdated' => true , 'message' => trans ( 'syntara::groups.messages.success' ) , 'messageType' => 'success' ) ) ; } else { return Response :: json ( array ( 'groupUpdated' => false , 'message' => trans ( 'syntara::groups.messages.try' ) , 'messageType' => 'danger' ) ) ; } } catch ( \ Cartalyst \ Sentry \ Groups \ NameRequiredException $ e ) { } catch ( \ Cartalyst \ Sentry \ Groups \ GroupExistsException $ e ) { return Response :: json ( array ( 'groupUpdated' => false , 'message' => trans ( 'syntara::groups.messages.exists' ) , 'messageType' => 'danger' ) ) ; } } }
Edit group action
@param int $groupId
Edit group action