Open4

Laravel Tips

Daniel PetricaDaniel Petrica

It may sound a bit silly but as I'm trying to write fully typed code I found out that managing TTLs values in an enum makes things more intuitive and organized. Here's an example from my app. When encountering it in the code we can easily read tenMinutes or oneDay to undersrand how long this TTL is.

Daniel PetricaDaniel Petrica

If you need to use the session in a web middleware make sure it's executed after the start session middleware. otherwise you won't understand why your site is not working

Daniel PetricaDaniel Petrica

So easy to handle currency display in Laravel ❤️

The ?? $price is just a personal preference instead of the default false return.

Daniel PetricaDaniel Petrica

I love Laravel, I just discovered the

@ pushOnce('scripts')

blade directive exists 😍