A new "Conditionable" trait is available in Laravel. Some Laravel classes such as the query builder already offered "when" and "unless" methods for conditionally executing a callback chain. Now you can easily add this feature to your own classes! 🔥

Laravel

I've started using random days in my Laravel factories. Since Carbon is already included, it's easy to do something like the below and generate posts created within the last 30 days.

Laravel

🔥 If you use @laravelphp Valet, run the `valet trust` command to update your sudoers so you don't have to enter your password every time you run a Valet command.

Laravel

Just prevent lazy loading in your Laravel projects that will save you of even unknown cases. Thanks to that, I realized I wasn't "eager loading" some relationships in my test suite. Thanks, @themsaid, for such a great addition to the framework.

Laravel

The @inertiajs form helper now has an `isDirty` property, making it really easy to check if any form values have changed. One great use case for this feature is showing a message to the user making them aware when they have unsaved form changes. https://t.co/SpkR03P7JM

Laravel
Vue.js

Many Laravel devs miss this. using DB validation rules like `exists` or `unique` for items of an array results in n number of DB queries. Better to fire single whereIn query and check the count.

Laravel

You need to constantly check if a user is an admin on your Laravel views? Create an "admin" directive and save some extra lines of code every time:

Laravel

Be careful with the __construct on your Laravel commands. Any instruction in there will be executed every time you call *any* command (it does not matter what command it is).

Laravel

✉ If you have a multi-language project in Laravel, remember to specify the locale when sending your mailables:

Laravel

Probably you know, but just in case: When testing your Laravel applications, use fast/dummy cache, session, queue, mail and, database drivers by configuring your phpunit.xml 👇👇

Laravel

Just discovered that @laravelphp Nova has an as-you-type Slug field! I built my own previously, but now I can swap it out ✌️ p.s. Read documentation periodically.

Laravel

After some 🔥 tweaks from @taylorotwell, Blade stringable support was merged into #Laravel today. So happy with the final syntax, its soooooooo squeaky clean. Look out for it in next week's release! 🥳

Laravel

The tweet will be reviewed and posted as soon as possible

{{ newSnippetForm.errors.url[0] }}

{{ newSnippetForm.errors.categories[0] }}