我想使用Lumen PHP Framework将NeoEloquent OMG连接到neo4j,但是当我执行以下命令时:
php artisan make:migration create_author_table
在控制台中显示以下消息:
Database [neo4j] not configured.
这些是我的配置:
.env
APP_ENV=local
APP_DEBUG=true
APP_KEY=
APP_TIMEZONE=UTC
LOG_CHANNEL=stack
LOG_SLACK_WEBHOOK_URL=
DB_CONNECTION=neo4j
DB_HOST=127.0.0.1
DB_PORT=7474
DB_DATABASE=neo4j
DB_USERNAME=neo4j
DB_PASSWORD=secret
CACHE_DRIVER=file
QUEUE_DRIVER=sync
database.php
<?php
return [
'default' => 'neo4j',
'connections' => [
'neo4j' => [
'driver' => 'neo4j',
'host' => env('DB_HOST', '127.0.0.1'),
'port' => env('DB_PORT', '7474'),
'username' => env('DB_USERNAME', 'neo4j'),
'password' => env('DB_PASSWORD', 'secret')
]
],
];
composer.json
{
"name": "laravel/lumen",
"description": "The Laravel Lumen Framework.",
"keywords": ["framework", "laravel", "lumen"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=7.1.3",
"laravel/lumen-framework": "5.6.*",
"vlucas/phpdotenv": "~2.2",
"vinelab/neoeloquent": "^1.4.6"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"phpunit/phpunit": "~7.0",
"mockery/mockery": "~1.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/"
]
},
"scripts": {
"post-root-package-install": [
"@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
},
"minimum-stability": "dev",
"prefer-stable": true
}
app.php
<?php
require_once __DIR__.'/../vendor/autoload.php';
try {
(new Dotenv\Dotenv(__DIR__.'/../'))->load();
} catch (Dotenv\Exception\InvalidPathException $e) {
//
}
$app = new Laravel\Lumen\Application(
realpath(__DIR__.'/../')
);
$app->configure('database');
// $app->withFacades();
// $app->withEloquent();
$app->singleton(
Illuminate\Contracts\Debug\ExceptionHandler::class,
App\Exceptions\Handler::class
);
$app->singleton(
Illuminate\Contracts\Console\Kernel::class,
App\Console\Kernel::class
);
// $app->middleware([
// App\Http\Middleware\ExampleMiddleware::class
// ]);
// $app->routeMiddleware([
// 'auth' => App\Http\Middleware\Authenticate::class,
// ]);
// $app->register(App\Providers\AppServiceProvider::class);
// $app->register(App\Providers\AuthServiceProvider::class);
// $app->register(App\Providers\EventServiceProvider::class);
$app->register('Vinelab\NeoEloquent\NeoEloquentServiceProvider');
$app->router->group([
'namespace' => 'App\Http\Controllers',
], function ($router) {
require __DIR__.'/../routes/web.php';
});
return $app;
我已经在Google,stackoverflow和任何地方进行搜索以找出此问题,但是我无法解决它。
答案 0 :(得分:0)
已修复,其中包含 database.php 的 config 文件夹位于 app 文件夹中,但应位于 root 文件夹。