Vinelab / NeoEloquent

The Neo4j OGM for Laravel
MIT License
633 stars 197 forks source link

Fatal error: Uncaught ReflectionException: Class db does not exist #267

Closed Awlexus closed 6 years ago

Awlexus commented 6 years ago

I'm trying to add NeoEloquent to my project, but I can't get past this error message.

I've added the ServiceProvider like this in config/app.php

'providers' => [ Vinelab\NeoEloquent\NeoEloquentServiceProvider::class ]

Added the connection in config/database.php 'neo4j' => [ 'driver' => 'neo4j', 'host' => env('NEO4J_HOST', 'localhost'), 'port' => env('NEO4J_PORT', '7474'), 'username' => env('NEO4J_USER', null), 'password' => env('NEO4J_PASSWORD', null) ]

and registered the service in bootstrap/app.php

$app->register('Vinelab\NeoEloquent\NeoEloquentServiceProvider');

Stacktrace:

Fatal error: Uncaught ReflectionException: Class db does not exist in D:\XAMPP\htdocs\Maturaprojekt\vendor\laravel\framework\src\Illuminate\Container\Container.php:752 Stack trace: #0 D:\XAMPP\htdocs\Maturaprojekt\vendor\laravel\framework\src\Illuminate\Container\Container.php(752): ReflectionClass->__construct('db') #1 D:\XAMPP\htdocs\Maturaprojekt\vendor\laravel\framework\src\Illuminate\Container\Container.php(631): Illuminate\Container\Container->build('db') #2 D:\XAMPP\htdocs\Maturaprojekt\vendor\laravel\framework\src\Illuminate\Container\Container.php(586): Illuminate\Container\Container->resolve('db', Array) #3 D:\XAMPP\htdocs\Maturaprojekt\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(732): Illuminate\Container\Container->make('db', Array) #4 D:\XAMPP\htdocs\Maturaprojekt\vendor\laravel\framework\src\Illuminate\Container\Container.php(1195): Illuminate\Foundation\Application->make('db') #5 D:\XAMPP\htdocs\Maturaprojekt\vendor\vinelab\neoeloquent\src\NeoEloquentServiceProvider.php(44): Illuminat in D:\XAMPP\htdocs\Maturaprojekt\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 752

m5kr1pka commented 6 years ago

and registered the service in bootstrap/app.php $app->register('Vinelab\NeoEloquent\NeoEloquentServiceProvider');

Just to make sure you are using lumen as quoted config is intended for it.

Otherwise, looks to me that you forgot to restart the server after implementation as the environment file have changed.

Awlexus commented 6 years ago

Alright, but now I still have the same Issue as #1 "Class 'App\Neo4j\NeoEloquent' not found"

I tried a "composer update", but it did not help 😢

Awlexus commented 6 years ago

As suggested by this answer I put a \ in front of Neoeloquent and it solved my issue