Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel and phpStorm integration - "cannot resolve directory"

I'm using Laravel 5.1 and I watched Jeffrey's video about how to fix the facades issues. Now, Everything almost works perfect.

when I try code on my views for example:

<script type="text/javascript" src="assets/js/page.js"></script>

phpStorm marks this location as an error because he cannot resolve the location of the file because he's looking for the file Root/app/resources/views/layouts/assets/js/page.js which doesn't exists.

How can I fix this?

like image 639
Eliya Cohen Avatar asked Jul 16 '15 13:07

Eliya Cohen


2 Answers

Step 1: Click on the File Menu

Step 2: Click on Settings, the following image should appear somewhat. (Yours may be different than mine)

Settings window

Step 3: In the search bar, type Directories, see the image:

Type Directories

Step 4: When you see the root of your project, click on the it and click on the Resource Root to mark it as the root of your project.

Step 5: Click on Apply

Step 6: Click on OK

And your query will be resolved. Hope this helps you out.

like image 134
Saiyan Prince Avatar answered Oct 11 '22 00:10

Saiyan Prince


Change src="assets/js/page.js" to src="{{ asset('assets/js/page.js')}}"

The assets function is actually a function not a folder. I think it is referencing the expected in the public folder, but I'm still not 100% on that!

like image 20
Cayce K Avatar answered Oct 10 '22 23:10

Cayce K