Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

quinta237's avatar

I am running Laravel 11, my controller is located in App\Http\Controllers\SupportTeam\BookController but for some reasons, my app finds it in SupportTeam\App\Http\Controllers\SupportTeam\BookController which is not available, how can I resolve this?

My BookController

0 likes
13 replies
Shivamyadav's avatar

Make sure to write it at top outside of the class in your controller

namespace App\Http\Controllers\SupportTeam;
Shivamyadav's avatar

Did you have created it manually or used artisan cmd . Show me your controller code

Shivamyadav's avatar

@quinta237 make sure that these two are imported in your Book controller

namespace App\Http\Controllers\SupportTeam;

use App\Http\Controllers\Controller;
quinta237's avatar

@Shivamyadav yes I triple checked! They are imported but still doesn't work, can I get remote support?

krisi_gjika's avatar

show the route group that uses this BookController

quinta237's avatar

@krisi_gjika

use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Auth;

Route::resource('events', EventController::class); Route::resource('messages', MessageController::class); Route::resource('books', BookController::class);

Shivamyadav's avatar

@quinta237 did you imported the Book controller class here in your web.php files if not then import it like this and try again

use App\Http\Controllers\SupportTeam\BookController;

iamputhea's avatar

@quinta237

use Illuminate\Support\Facades\Route; 
use Illuminate\Support\Facades\Auth;

Route::resource('events', EventController::class); 
Route::resource('messages', MessageController::class); 
Route::resource('books', BookController::class);

please format code like this next time when you post code

Snapey's avatar

learn to format your flippin code blocks

3 likes
martinbean's avatar

@quinta237 Please just post the entire controller, and your entire routes file. And format the code when you do.

iamputhea's avatar

make sure your controller name space namespace App\Http\Controllers\SupportTeam;

Try run composer dump-autoload and then test it again

Please or to participate in this conversation.