I am trying to use Neo4j database in a Laravel project using NeoEloquent driver. I followed the instructions there. The config/database.php
file has:
'default' => 'neo4j',
'connections' => [
'neo4j' => [
'driver' => 'neo4j',
'host' => 'localhost',
'port' => 7687,
'username' => 'neo4j',
'password' => 'neo4j',
],
.........
]
In web.php
, I have:
Route::get('/save/country', [CountryController::class,'store'])->name('save_country');
Country.php
model file has:
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use NeoEloquent;
// class Country extends Model
class Country extends NeoEloquent
{
use HasFactory;
protected $fillable = [
'country'
];
}
In CountryController.php
, I have -
public function store(StoreCountryRequest $request) {
$country_info = new Country();
$country_info->country='India';
$relation = $country_info->save();
echo 'Success';
}
When I hit the URL save/country
, I get the Exception:
RuntimeException Cannot connect to any server on alias: default with Uris: ('bolt://localhost:7687')
What is the thing that I am doing wrong ? How to make the problem go away ?
EDIT: I am using Neo4j Desktop app from here.