cmgmyr / laravel-messenger

Simple user messaging package for Laravel
MIT License
2.46k stars 517 forks source link

v2.23 is broken #364

Closed LorenzoSapora closed 2 years ago

LorenzoSapora commented 2 years ago
Return value of Cmgmyr\Messenger\Models\Models::thread() must be an instance of Cmgmyr\Messenger\Models\Thread, instance of App\Models\Thread returned

Current fix: composer require cmgmyr/messenger:2.22 to downgrade

cmgmyr commented 2 years ago

@LorenzoSapora thanks for reporting, I should be able to look into this today.

Curious - is your App\Models\Thread extending the package's Thread model, or no?

LorenzoSapora commented 2 years ago

It is not. This is an old install with a half developed messenger system (currently just in code, no frontend, as unfinished project).

Note: composer was previously checking for ^2, so this update came as a surprise. System is PHP 7.4.

cmgmyr commented 2 years ago

@LorenzoSapora can you try pulling the current dev-master in your composer.json file? It should be fixed for you. If that works I can tag another release today

Also, if you have time, can you let me know if implementing a Message interface would fix the issue? That way we could eventually use the interface return types and your custom code could optionally implement the interface, or extend the package's Message class. This would be done for all of the models too. Have you implemented all of the methods or just the ones you need in your app?

LorenzoSapora commented 2 years ago

Sorry for the delay, yes, that fixes my issues.

As for the Message interface, it would provide some additional structure in the future, and I'm struggling to find a reason not to just say "sure". 😄

cmgmyr commented 2 years ago

Excellent! Thanks for letting me know. I'm waiting to hear back on another issue; then, I'll tag a release and close this issue

I'll chew on the interface idea a little more and see if it makes sense to do in a future release - thanks for the feedback!

LorenzoSapora commented 2 years ago

Perfect. Thanks for all your work here. I appreciate it.

cmgmyr commented 2 years ago

Just tagged a release for 2.24.0. Please let me know if you have anything else come up. Thanks so much for using this package!