ash-jc-allen / short-url

A Laravel package for creating shortened URLs for your web apps.
MIT License
1.25k stars 158 forks source link

Fix error when app is set to use CarbonImmutable #285

Closed sshead closed 3 months ago

sshead commented 3 months ago

Replaces #284.

Recap: Currently the package breaks if your app has configured the Date facade to use CarbonImmutable instead of Carbon (as per this blog post by Michael Dyrynda).

To get it working is a one-line fix - changing one instance of now() to Carbon::now() in the Builder class.

Some comments/caveats:

Hope this is an improvement on the last effort.

ash-jc-allen commented 3 months ago

Hey @sshead! Sorry for the slow response on this one - this week's been crazy busy haha! I'm intending on checking this PR out tonight or tomorrow and getting back to you on it 😄

ash-jc-allen commented 3 months ago

Hey @sshead, huge thanks for this fix and the test update too! I'd have only done pretty much the same thing myself 😄

The Carbon, CarbonInterface, and CarbonImmutable topic is something I'm definitely going to think about when I do the next major version. This works at the moment (and is the quickest/easiest to get released), but I reckon I'd prefer to use an approach like you proposed in your last PR in the long run. Maybe we can reopen that PR at some point in the future.

Thanks again, I appreciate it! 🔥