It would be nice if we could specify different connections to Voyager and main tables. By "main" I mean tables that are in main project. I prefer using admin panel as a separate project. So we could specify another connection in database.php.
This would also make it easy to add a prefix to the table names (#64)
@adriaanzon
Yeah, but may be I want Voyager be in one database and my main project in another. Even separate MySQL instances.
But Voyager is an admin panel to manage your application if you have separate databases are you managing a different app? It needs access to your app data.
@afsardo No I manage my own application. And I use micro-service architecture. So API, Web and other services are separated.
So do you need Voyager for what? :X Sorry having a hard time understanding it.
@afsardo Administration Interface for current database
Hum what you mean is using Voyager with access to your app database, but all things db related voyager needs to work are stored in a diff db? I see..
I think that is a "whole" new product, one i am actually working on, generating a Backend for API.
Let's see the Maintainers opinion on it.
@afsardo I think it would not be so hard. I can spend time and create pull request for this. It's just separating the entities. Voyager looks like Blog system with Admin interface right now, but not like Admin Interface.
Hum maybe you are right ;) Hope you do it! That would be an awesome addition and really powerful.
Any help or "lack of ideas" shoot me a message we can try and get a solution.
@afsardo Already started to work on. I also suggest to use PSR-2.
Completely agree with you ;) In Sublime i have an auto format part of the build process, need to install it in Visual Code too.
@afsardo what do you think about this:
// This is for Voyager
'mysql' => [
'driver' => 'mysql',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'forge'),
'username' => env('DB_USERNAME', 'forge'),
'password' => env('DB_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
// This is for Entities aka Main database
'main' => [
'driver' => 'mysql',
'host' => env('DB_MAIN_HOST', 'localhost'),
'port' => env('DB_MAIN_PORT', '3306'),
'database' => env('DB_MAIN_DATABASE', 'forge'),
'username' => env('DB_MAIN_USERNAME', 'forge'),
'password' => env('DB_MAIN_PASSWORD', ''),
'charset' => 'utf8',
'collation' => 'utf8_unicode_ci',
'prefix' => '',
'strict' => true,
'engine' => null,
],
I think it looks easy and clean ^^ Great Job!
Are you still working on this @vladimir-yuldashev?
My idea to get this to work is quite simply, to enable overwriting the models of Voyager, and then a user may add the protected $connection = 'voyager'; to the models they wish to separate from the application database.
Closing this since it will become possible to overwrite a Voyager model using in v0.11.
Then this can be done adding
protected $connection = 'voyager';
However, we have not yet figured out the best way to enable overwriting of the Voyager models. You can take a look at the discussion for this and let us know what solution you would prefer.
Reference #693
I add this functionality in my repository and awaiting pull request #2175 if something need it.
This issue has been automatically locked since there has not been any recent activity after it was closed. If you have further questions please ask in our Slack group.