laravel-model-settings icon indicating copy to clipboard operation
laravel-model-settings copied to clipboard

[Proposal] Removed Model::getConnectionName() override

Open telkins opened this issue 1 year ago • 1 comments

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. 🤓

telkins avatar Apr 26 '24 15:04 telkins

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

jorioux avatar Apr 08 '25 19:04 jorioux