vincej
514
5
Laravel

Why Do I Get an Error When Applying a NameSpace to My Controller ?

Posted 3 years ago by vincej

Hi - Within the Http/Controllers folder I want to add a variety of additional folders to reflect a deepening application structure. So for example:

Directory Structure: Http / Controllers / Public / Contractors / ContractorsController.php

When I apply the Namespace to the ContractorsController.php I am getting an error the moment I go beyond :

App/Http / Controllers/

When I do so, I get the error on PHPStorm:

"expecting identifier"

And if I try to go further with for example:

App\Http\Controllers\Public\Contractors; The "Contractors" element is also lit up "Undefined Constant"

This is very curious as the namespace: "App\Http\Controllers\Auth" gives no error.

What have I done wrong ?

Many thanks !

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.