<commit_before><?php namespace Aliukevicius\LaravelRbac\Controllers; 

use Aliukevicius\LaravelRbac\Services\PermissionService;
use Aliukevicius\LaravelRbac\Models\Permission;

class PermissionController extends Controller {

    /** @var \Illuminate\Database\Eloquent\Model */
    protected $roleModel;

    /** @var Permission */
    protected $permissionModel;

    /** @var PermissionService */
    protected $permissionService;

    public function __construct(PermissionService $permissionService, Permission $permission)
    {
        $this->roleModel = \App::make(\Config::get('laravel-rbac.roleModel'));
        $this->permissionModel = $permission;
        $this->permissionService = $permissionService;
    }

    public function index()
    {
        $roles = $this->roleModel->all();
        $permissions = $this->permissionService->getGroupedByControllerPermissions();

        $roleCount = count($roles);

        $rolePermissions = $this->permissionService->getRolePermissions();;

        $activePermissions = $this->permissionService->getRolePermissions();

        return view('aliukevicius/laravelRbac::permissions.index', compact(
            'roles',
            'permissions',
            'activePermissions',
            'roleCount',
            'rolePermissions'
        ));
    }

    public function updatePermissionList()
    {
        $this->permissionService->updatePermissionList();

        return \Redirect::to(\URL::action('\\' . \Config::get('laravel-rbac.permissionController') . '@index'));
    }

    public function savePermissions()
    {
        $permissions = \Input::get('permissions', []);

        $this->permissionService->savePermissions($permissions);

        return \Redirect::to(\URL::action('\\' . \Config::get('laravel-rbac.permissionController') . '@index'));
    }
}<commit_msg>Fix role selection in PermissionController<commit_after><?php namespace Aliukevicius\LaravelRbac\Controllers; 

use Aliukevicius\LaravelRbac\Services\PermissionService;
use Aliukevicius\LaravelRbac\Services\RoleService;
use Aliukevicius\LaravelRbac\Models\Permission;

class PermissionController extends Controller {

    /** @var \Illuminate\Database\Eloquent\Model */
    protected $roleModel;

    /** @var Permission */
    protected $permissionModel;

    /** @var PermissionService */
    protected $permissionService;

    /** @var RoleService */
    protected $roleService;

    public function __construct(PermissionService $permissionService, Permission $permission, RoleService $roleService)
    {
        $this->roleModel = \App::make(\Config::get('laravel-rbac.roleModel'));
        $this->permissionModel = $permission;
        $this->permissionService = $permissionService;
        $this->roleService = $roleService;
    }

    public function index()
    {
        $roles = $this->roleModel->all();
        $permissions = $this->permissionService->getGroupedByControllerPermissions();

        $roleCount = count($roles);

        $rolePermissions = $this->roleService->getRolePermissions();;

        $activePermissions = $this->roleService->getRolePermissions();

        return view('aliukevicius/laravelRbac::permissions.index', compact(
            'roles',
            'permissions',
            'activePermissions',
            'roleCount',
            'rolePermissions'
        ));
    }

    public function updatePermissionList()
    {
        $this->permissionService->updatePermissionList();

        return \Redirect::to(\URL::action('\\' . \Config::get('laravel-rbac.permissionController') . '@index'));
    }

    public function savePermissions()
    {
        $permissions = \Input::get('permissions', []);

        $this->permissionService->savePermissions($permissions);

        return \Redirect::to(\URL::action('\\' . \Config::get('laravel-rbac.permissionController') . '@index'));
    }
}
{'fraction_non_alphanumeric': 0.1383419689119171, 'fraction_numerical': 0.0, 'mean_word_length': 3.2757475083056478, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 34, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4998876', 'n_tokens_mistral': 1072, 'n_tokens_neox': 1022, 'n_words': 162}