Skip to content

Can't use fully qualified class names in namespaced routes #25511

@Lloople

Description

@Lloople
  • Laravel Version: 5.7.1
  • PHP Version: 7.2
  • Database Driver & Version: MySQL 5.6

Description:

The Router class is appending the group namespace to a route which has been declared as a single action controller using fully qualified class name.

The problem is that a fully qualified class name doesn't starts with \, so the code in prependGroupNamespace will concatenate the namespace to it.

App\Http\Controllers\InvokableController::class will evaluate to App\Http\Controllers\App\Http\Controllers\Invokable

Steps To Reproduce:

Create an invokable controller: php artisan make:controller InvokableController --invoke

Declare a route in your web.php file:

Route::get('invokable', \App\Http\Controllers\InvokableController::class);

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