Skip to content

options 颜色列表不存在导致的 bug #9

@yunlongw

Description

@yunlongw

我在路由中定义了一个 options 的路由 ,在打开 api-test 模块后报错 Undefined index: OPTIONS

vendor/laravel-admin-ext/api-tester/src/ApiTester.php

   public static $methodColors = [
        'GET'    => 'green',
        'HEAD'   => 'gray',
        'POST'   => 'blue',
        'PUT'    => 'yellow',
        'DELETE' => 'red',
        'PATCH'  => 'aqua',
    ];

vendor/laravel-admin-ext/api-tester/resources/views/index.blade.php

@foreach($routes as $route)
    @php ($color = Encore\Admin\ApiTester\ApiTester::$methodColors[$route['method']])
        <li class="route-item"
            data-uri="{{ $route['uri'] }}"
            data-method="{{ $route['method'] }}"
            data-method-color="{{$color}}"
            data-parameters='{!! $route['parameters'] !!}' >
            
            <a href="#"><b>{{ $route['uri'] }}</b>
            <div class="pull-right">
                <span class="label bg-{{ $color }}">{{ $route['method'] }}</span>
            </div>
            </a>
        </li>
@endforeach

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions