Search code examples
phplaravelphpstorm

PhpStorm does not recognize my models in the app folder


I am using Laravel 7. I use PhpStorm, and great fan of it.

I want to store all of my model files in a single folder named Models into app folder. I changed this line:

namespace App; -> namespace App/Models.

But PhpStorm is giving me an error. It doesn't recognize my folder:

Undefined constant 'Models'

How can I fix this?

the error photo


Solution

  • Use the anti slash for namespace

    namespace App\Models;