Closed ideepblue closed 3 years ago
In my application, I use MySQL and Neo4j at the same time. So I manually assign the neo4j connection for the Model which uses Neo4j. For example:
use Vinelab\NeoEloquent\Eloquent\Model as NeoEloquentModel; use Vinelab\NeoEloquent\Eloquent\SoftDeletes; class SomeModel extends NeoEloquentModel { use SoftDeletes; protected $connection = 'neo4j'; /** * @var array Soft deleting column */ protected $dates = ['deleted_at']; }
I followed the instruction to save Neo4j Model, which works:
$someModel = new SomeModel(['name' => 'some name']); $someModel->save();
However, I tried the other two ways, which doesn't work. I debugged the code and found they always use the default database connection setting mysql.
$someModel = SomeModel::create(['name' => 'some name']); $someModel = SomeModel::on('neo4j')->create(['name' => 'some name']);
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
In my application, I use MySQL and Neo4j at the same time. So I manually assign the neo4j connection for the Model which uses Neo4j. For example:
I followed the instruction to save Neo4j Model, which works:
However, I tried the other two ways, which doesn't work. I debugged the code and found they always use the default database connection setting mysql.