Reputation: 2143
I have created a new project in Laravel and I have opened it with the Eclipse IDE (for PHP), but I get an error in the default code generated by Laravel for the routes. How can I prevent this from happening?
I have only created the project and I have opened it with Eclipse and I have that error.
Upvotes: 4
Views: 4631
Reputation: 357
put
namespace Illuminate\Support\Facades;
at the top of the file
Upvotes: -2
Reputation: 31
I'm new to Eclipse and just ran into the same problem and solved it by creating a library. My Eclipse version is 2018-09 (4.9.0).
Firstly, require the barryvdh/laravel-ide-helper package with composer using the following command:
composer require barryvdh/laravel-ide-helper
Afterwards generate the _ide_helper.php with Artisan:
php artisan ide-helper:generate
Copy the generated file into a directory outside of your workspace
Once the library is created you may need to delete all the entries in the "Problems" View and validate the project again.
Upvotes: 3
Reputation:
Import the Route
facade at the top of the file like Request
.
use Illuminate\Support\Facades\Route;
I recommend using this package, barrydvh/ide-helper, in your projects. It generates a mapping of Laravel's facades and other static methods that the IDE has trouble with out of the box.
You'll need to install Eclipse PHP plugin (PDT)
, as well.
Once you have everything setup, run:
php artisan ide-helper:generate
and refresh the project.
Upvotes: 4