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

kramsuiluj's avatar

Manually moving a controller to a new directory

I am trying to refactor my code and arrange my files, I decided to split my controller files into categories based on user roles, admin, teacher and student.

When I create a directory manually on my editor it doesn't show when I type hint the path, and even if I type the correct path it gives me an error, even though I moved the files into a different directory it is still being used from the default controller path App\Http\Controllers.

But when I create the directory and controller using artisan command it is being recognized, so how can I do it manually?

0 likes
1 reply
tykus's avatar
tykus
Best Answer
Level 104

Update the existing controller’s namespace to match the directory structure.

1 like

Please or to participate in this conversation.