-
Notifications
You must be signed in to change notification settings - Fork 11.6k
Closed
Description
- Laravel Version: 5.7.5
- PHP Version: 7.1.23
- Database Driver & Version: N/A
Description:
Presume the following two lines of code are present at the end of all four following examples:
Route::resource('threads', ThreadController::class);
Route::post('/threads/{thread}/replies', [ReplyController::class, 'store']);Depending on the use statements, things either work or don't or some variation thereof:
Example 1
use App\Http\Controllers\ReplyController;
// All routes work.Example 2
// (No use statements)
// Only the routes on the threads resource work, otherwise:
// ReflectionException, Function () does not existExample 3
use App\Http\Controllers\ThreadController;
use App\Http\Controllers\ReplyController;
// Only the store reply route works, otherwise:
// App\Http\Controllers\App\Http\Controllers\ThreadController does not existExample 4
use App\Http\Controllers\ThreadController;
// None of the routes work.
// App\Http\Controllers\App\Http\Controllers\ThreadController does not existI would expect either #2 or #3 to be the one where all routes work?
Surely this is unintended behaviour. It's a little confusing to me.
Steps To Reproduce:
- Scaffold a new laravel project
php artisan make:controller ThreadController -rphp artisan make:controller ReplyController -r- Try the 4 combinations of use statements above, with the 2 route declarations below.
Metadata
Metadata
Assignees
Labels
No labels