Skip to content

[Proposal] Removed Model::getConnectionName() override #122

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

telkins
Copy link

@telkins telkins commented Apr 26, 2024

This is a great package, but it overrides Model::getConnectionName(), which proves to be a problem. We already have simple traits that do something similar and we can't have both.

This solution moves the fallback call to config() (which one could argue might not be necessary) to the two instances where getConnectionName() is called.

Alternatives:

  • Change getConnectionName() to getLaravelModelSettingsConnectionName(), which, in turn, calls getConnectionName() and handles the fallback.
  • Don't worry about the fallback. I think that Model will eventually fall back to the default connection. (See Illuminate\Database\ConnectionResolver.)
  • ...?

Let me know if you have questions/concerns, and thanks for the great work thus far. 🤓

@glorand glorand force-pushed the get-connection-name-fix branch from d37f443 to b77764f Compare March 15, 2025 20:31
@glorand glorand self-assigned this Mar 15, 2025
@jorioux
Copy link

jorioux commented Apr 8, 2025

The getConnectionName() function also conflicts with the Tenancy for Laravel package. I would love to see this PR merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants