tenancy / multi-tenant

Run multiple websites using the same Laravel installation while keeping tenant specific data separated for fully independent multi-domain setups, previously github.com/hyn/multi-tenant
https://tenancy.dev
MIT License
2.56k stars 394 forks source link

Argument 1 passed to Hyn\Tenancy\Listeners\Database\FlushHostnameCache::saved() must be an instance of Hyn\Tenancy\Models\Hostname #915

Closed catalinbuletin closed 4 years ago

catalinbuletin commented 4 years ago

Hello, First of all I want to thank you for your effort to build this package. Really good job!

Description

I have a dedicated model for the Hostname that implements \Hyn\Tenancy\Contracts\Hostname I have just upgraded from version 5.5 to 5.6 and i got an issue when creating a new Hostname.

Before the upgrade all was working ok.


Actual behavior

I get the following error Argument 1 passed to Hyn\Tenancy\Listeners\Database\FlushHostnameCache::saved() must be an instance of Hyn\Tenancy\Models\Hostname, instance of App\Models\System\Hostname given

I think best would be that the FlushHostnameCache::saved() method to have the \Hyn\Tenancy\Contracts\Hostname contract as argument not the concrete implementation.


Information

RERE110 commented 4 years ago

Same problem for me

id1385 commented 4 years ago

Same problem for me

fletch3555 commented 4 years ago

For anyone having this issue, can you confirm whether your Hostname class extends Hyn\Tenancy\Models\Hostname? (If not, it should)

catalinbuletin commented 4 years ago

Hi @fletch3555,

I was not extending the Hyn\Tenancy\Models\Hostname. I was implementing the \Hyn\Tenancy\Contracts\Hostname.

By extending the model as you said it's working fine. But i'm not so sure we should have to extend the model when the package also provides in interface for it.

Thanks for the support.