9
π₯ Convert email addresses to full names with the help of Str::headline()
Ran into a great use-case for Str::headline() -- Generating displayable usernames from email addresses π
π₯ This week's code tips for Laravel developers
A weekly thread π§΅
9
Ran into a great use-case for Str::headline() -- Generating displayable usernames from email addresses π
8
Sometimes I forget about higher order collection messages in Laravel, but they're a great way to shorten and tidy up your code β¨
Here's a simplified (and not recommended) example.
7
πΆοΈ #Laravel tip: When using timestamp() columns in Laravel Migrations, append the useCurrent() & useCurrentOnUpdate() to set timestamp columns' default value to CURRENT_TIMESTAMP
#PHP #Developers
6
β¨Did you know Tailwind CSS has a shorthand syntax for background, border, and text opacity?
π https://tailwindcss.com/docs/background-color#changing-the-opacity
5
I absolutely love the little "value" helper method in @laravelphp as it allows you to create beautiful APIs with ease under the hood.
4
π₯ Eloquent scopes pair very well with complex relation queries
Scopes should also have @method annotations. They make the model more self-documenting & better supported in IDEs
3
β‘οΈ Database Tip
Every database performance guide is repeating the false statement stating WHERE LIKE '%search%' queries can't use an index. That is just not true! Most probably your database can't, but PostgreSQL implements trigram indexes which will make this really fast!
2
Since @laravelphp 8.79 it is possible to resolve variadic dependencies out of the IoC container.
This is quite useful for type-hinting and static analysis and allows us to bind a set of concrete implementations to an abstraction layer.
#Laravel #PHP
1
π‘There's a really helpful date helper on the Request class.
You can retrieve a value as a Carbon instance:
We're writing a book, you can get it for free here. We're writing a book! Join the early access to get it for free.