πŸ”₯ Weekly thread #35 of 2022

πŸ”₯ We're back to posting our threads!

In our news thread (will be posted shortly after this one), I'll share some updates about Tenancy v4 and our content schedule

In the meantime: Best Laravel tips from the past few months πŸ‘‡

You can temporarily disable an index by making it INVISIBLE

6

πŸ”₯ You can temporarily disable an index by making it INVISIBLE

You can temporarily disable an index by making it INVISIBLE

⚑️ Database Tip

Deleting an unused index is still a risky operation: If you are wrong (and it is still needed) the database will become slow. Before deleting it, you can make the index invisible first and make it visible again instantly if you still need it.

You can use a partial index to enforce uniqueness in tables that can have soft-deleted records

5

πŸ”₯ You can use a partial index to enforce uniqueness in tables that can have soft-deleted records

You can use a partial index to enforce uniqueness in tables that can have soft-deleted records

⚑️ Database Tip

Unique indexes can not be created in some cases because a value is duplicated by e.g. soft-deleted rows.

But with partial indexes and creative tricks you can exclude some rows to create the uniqueness constraint on a selection of rows.

https://sqlfordevs.com/unique-index-ignore-some-rows

You can echo backed enums in Blade

2

πŸ”₯ You can echo backed enums in Blade

You can echo backed enums in Blade

Papercut: starting today's @laravelphp release, Blade can now infer values from PHP 8.1 backed enums. πŸ’…πŸ»

You can run your tests in a random order

1

πŸ”₯ You can run your tests in a random order

You can run your tests in a random order

πŸ™‚πŸ™ƒπŸ™‚ Have you ever tried running your tests in random order?

This can be helpful to detect interdependencies between tests.

(works on @pestphp and PHPUnit)

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