protected function parsePermissionId($permission)
    {
        if ( is_string($permission) || is_numeric($permission) ) {

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

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

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

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

        return (int) $permission;
    }
protected function parsePermissionId($permission)
    {
        if ( is_string($permission) || is_numeric($permission) ) {

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

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

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

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

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

@param object|array|int $permission
@return mixed
Parses permission id from object or array .