3

I updated my project from laravel 5.5.* to 5.5.43... Before the update everything was ok. But after the update, I see a warning message in route/web.php.

laravel route warning

It says: Required parameter $routes missing.

But everything is working fine. Then when I put an empty string in the second parameter warning message gone.

laravel route warning

So my question is:

  1. What should I put in the required second parameter?
  2. If it's required then why everything is working fine? It should be optional.
Sand Of Vega
  • 2,297
  • 16
  • 29

1 Answers1

0

This is actually pretty hard to follow in Laravel. Your IDE is pulling the group definition from Router instead of RouteRegistrar.

Inside Router.php:

public function group(array $attributes, $routes)

This supports the older style of route group definitions where middleware are defined in attributes and your routes closure would be the 2nd argument.

Inside RouteRegistrar.php:

public function group($callback)

This is the new style where group only accepts the closure.


I don't like the fact that they used a condition in __call instead of defining a method for middleware, but when you call Route::middleware, the facade forwards to Router and Router::__call is returning a RouteRegistrar instance because of this line:

    if ($method == 'middleware') {
        return (new RouteRegistrar($this))->attribute($method, is_array($parameters[0]) ? $parameters[0] : $parameters);
    }
Devon Bessemer
  • 34,461
  • 9
  • 69
  • 95