Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat] Need to specify connection name for db. #74

Open
Saifallak opened this issue Aug 6, 2024 · 0 comments
Open

[Feat] Need to specify connection name for db. #74

Saifallak opened this issue Aug 6, 2024 · 0 comments
Assignees
Labels
enhancement New feature or request

Comments

@Saifallak
Copy link

In case of project with multi database connection, we need the ability to specify the database connection.

also we usually, create separate db, for activity logs and other monitoring,

and other packages doing that, like spatie activity logs, and telescope for laravel and pulse ...etc.

steps:
need to add

'database_connection' => env('ACTIVITY_LOGGER_DB_CONNECTION', 'mysql'),

to config

also

in schemas

Schema::connection(config('xxxxxx.database_connection'))->create('xxxxxx', function (Blueprint $table) {

also in model construct

if (! isset($this->connection)) {
            $this->setConnection(config('xxxxxxx.database_connection'));
        }

example https://github.com/spatie/laravel-activitylog/pull/568/files

@marcogermani87 marcogermani87 added the enhancement New feature or request label Aug 7, 2024
@marcogermani87 marcogermani87 self-assigned this Aug 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants