Route of Laravel 5.5 with "where"

0

Hi, I'm starting to move my web to Laravel and I run into a problem with a clause where that has a small regex

Route::get('/{region}/leader/{bracket}', 'LeaderController')
        ->where(['region' => '(en|us)', 'bracket' => '(2v2|3v3|rbg)']);

I leave you the start of the test:

.3 by Sebastian Bergmann and contributors.

F.                                                                  2 / 2 (100%)

Time: 202 ms, Memory: 12.00MB

There was 1 failure:

1) Tests\Feature\LeaderControllerTest::its_load_leader_eu_2v2
Expected status code 200 but received 404.
Failed asserting that false is true.

C:\laragon\www\murlocmate\vendor\laravel\framework\src\Illuminate\Foundation\Testing\TestResponse.php:78
C:\laragon\www\murlocmate\tests\Feature\LeaderControllerTest.php:14

FAILURES!
Tests: 2, Assertions: 2, Failures: 1.

Test code:

public function its_load_leader_eu_2v2()
    {
        $this->get('/eu/leader/2v2')
            ->assertStatus(200)
            ->assertSee('eu 2v2');
    }
    
asked by Akond 01.11.2017 в 05:07
source

1 answer

0

The truth is I do not know why that where in the route does not work, at the end I had to add the clause to the RouteServiceProvides.php file of the Providers folder, I added the following:

public function boot()
    {
        //
        Route::pattern('region', '(eu|us)');
        Route::pattern('bracket', '(2v2|3v3|rbg)');

        parent::boot();
    }
    
answered by 02.11.2017 в 08:22