protected function parseRoleId($role)
    {
        if ( is_string($role) || is_numeric($role) ) {

            $model = config('acl.role', 'Kodeine\Acl\Models\Eloquent\Role');
            $key = is_numeric($role) ? 'id' : 'slug';
            $alias = (new $model)->where($key, $role)->first();

            if ( ! is_object($alias) || ! $alias->exists ) {
                throw new \InvalidArgumentException('Specified role ' . $key . ' does not exists.');
            }

            $role = $alias->getKey();
        }

        $model = '\Illuminate\Database\Eloquent\Model';
        if ( is_object($role) && $role instanceof $model ) {
            $role = $role->getKey();
        }

        return (int) $role;
    }
protected function parseRoleId($role)
    {
        if ( is_string($role) || is_numeric($role) ) {

            $model = config('acl.role', 'Kodeine\Acl\Models\Eloquent\Role');
            $key = is_numeric($role) ? 'id' : 'slug';
            $alias = (new $model)->where($key, $role)->first();

            if ( ! is_object($alias) || ! $alias->exists ) {
                throw new \InvalidArgumentException('Specified role ' . $key . ' does not exists.');
            }

            $role = $alias->getKey();
        }

        $model = '\Illuminate\Database\Eloquent\Model';
        if ( is_object($role) && $role instanceof $model ) {
            $role = $role->getKey();
        }

        return (int) $role;
    }
protected function parseRoleId ( $ role ) { if ( is_string ( $ role ) || is_numeric ( $ role ) ) { $ model = config ( 'acl.role' , 'Kodeine\Acl\Models\Eloquent\Role' ) ; $ key = is_numeric ( $ role ) ? 'id' : 'slug' ; $ alias = ( new $ model ) -> where ( $ key , $ role ) -> first ( ) ; if ( ! is_object ( $ alias ) || ! $ alias -> exists ) { throw new \ InvalidArgumentException ( 'Specified role ' . $ key . ' does not exists.' ) ; } $ role = $ alias -> getKey ( ) ; } $ model = '\Illuminate\Database\Eloquent\Model' ; if ( is_object ( $ role ) && $ role instanceof $ model ) { $ role = $ role -> getKey ( ) ; } return ( int ) $ role ; }
Parses role id from object, array
or a string.

@param object|array|string|int $role
@return int
Parses role id from object array or a string .