🔥 Weekly thread #28 of 2022

🔥 This week's code tips and updates for Laravel developers include:

✨ Laravel Nova v4.12 🔥 Blade hot refreshing 👨🏻‍🏫 Learn with Christoph Rumpel 3️⃣ Three rules for creating database indices 🆓 Request Data Access task in Shift Workbench

and more...

Thread #129

You can time travel() in your tests

3

🔥 You can time travel() in your tests

You can time travel() in your tests

🔮 Travel in time in your Laravel tests.

Using the travel() method you can travel back and forward in time.

No more Carbon::setTestNow()

Super useful 👏

Be careful if you're not scoping your route model bindings

2

🔥 Be careful if you're not scoping your route model bindings

Be careful if you're not scoping your route model bindings

I've caught myself writing this security bug many times in controllers, making the assumption that Laravel will retrieve child route bound models by the parent model by default. Be careful if you're not scoping your route model bindings!

You can use `Str::markdown` to build translation strings

1

🔥 You can use `Str::markdown` to build translation strings

You can use `Str::markdown` to build translation strings

Ever needed to add HTML inside a Laravel translation string, and had to split the string up into chunks?

Or felt bad about raw HTML in your translations?

Here's a little cheat - parse markdown. Most of the formatting you want to do inside a translation string is available. 🤷‍♂️

We're writing a book, you can get it for free here.