Christoffer
Christoffer

Reputation: 7787

Undefined default namespaces in Laravel 5.1

I'm developing an app in Laravel 5.1. And for some reason there's loads of default namespace paths that are red (using PHPStorm 10). They are marked as "undefined namespace"

For example, when I make a model with artisan it ends up with this:

use Illuminate\Database\Eloquent\Model;

class Form extends Model
{
    //
}

And Eloquent is red. So I can't use the model.

Same goes in app/config/app.php

Where Illuminate\Support\Facades\

where Facades is red.

These are tons of namespace errors like this (under the Illuminate root ). Any idea with it might be? See below...

enter image description here

Upvotes: 5

Views: 5449

Answers (4)

Mke Nt
Mke Nt

Reputation: 105

In PhpStorm :

  1. Delete the .idea folder from your project,
  2. File => Invalidate Caches / Restart,
  3. Restart PhpStorm.

It worked for me.

Upvotes: 4

huuthang
huuthang

Reputation: 474

Try this:

Open setting-> (setting path in image) check "Synchronize IDE settings with composer.json"

enter image description here

Upvotes: 1

Paranoid Android
Paranoid Android

Reputation: 5047

When it happens to me, I place my cursor before use and press enter.

Sometimes it fixes that.

Upvotes: 0

djo
djo

Reputation: 91

It's a problem of PHPSTORM. For those who have this problem, I resolve it by : - close phpstorm - remove the project folder .idea - create a new project with existing files.

It worked for me.

Upvotes: 7

Related Questions