LaravelShots's profile picture. Laravel tips packed in a simple tweet. Sending 3 high-quality laravel tips and resources to your inbox every month. By @introwit

Laravel Shots

@LaravelShots

Laravel tips packed in a simple tweet. Sending 3 high-quality laravel tips and resources to your inbox every month. By @introwit

Laravel Shots รีโพสต์แล้ว

Really digging Laravel's `firstOr()` method! laravel.com/docs/8.x/eloqu…

jessarchercodes's tweet image. Really digging Laravel's `firstOr()` method!

laravel.com/docs/8.x/eloqu…

Laravel Shots รีโพสต์แล้ว

A @Laravelphp tip from Kirschbaum senior developer Rob Fonseca @therobfonz If you need to ensure a Artisan command runs after another one completes, use the then() method. #laravel #webapplicationdevelopment

kirschbaum_dev's tweet image. A @Laravelphp tip from Kirschbaum senior developer Rob Fonseca @therobfonz  
If you need to ensure a Artisan command runs after another one completes, use the then() method. 
#laravel #webapplicationdevelopment

Laravel Shots รีโพสต์แล้ว

🤤Remove those conditionals around code responsible to dispatch jobs and let @laravelphp make it cleaner for you!

introwit's tweet image. 🤤Remove those conditionals around code responsible to dispatch jobs and let @laravelphp make it cleaner for you!

So beautiful! 🤤

In @laravelphp, the "partition()" method may be combined with the array destructuring PHP feature to separate elements that pass a given truth test from those that do not. 🖖🏻

enunomaduro's tweet image. In @laravelphp, the "partition()" method may be combined with the array destructuring PHP feature to separate elements that pass a given truth test from those that do not. 🖖🏻


😧 Woah! 🏃‍♂️ _runs to refactor the test suite_ 🏃‍♂️

🔥 One of my favourite testing helpers is a `login` method on the base `TestCase` class. Perfect for quickly creating a `User` and logging them in, as well as customising the `UserFactory` via a callback function. gist.github.com/ryangjchandler…

ryangjchandler's tweet image. 🔥 One of my favourite testing helpers is a `login` method on the base `TestCase` class. Perfect for quickly creating a `User` and logging them in, as well as customising the `UserFactory` via a callback function. gist.github.com/ryangjchandler…


💥 Bookmark this one 👇

This is a bunch of options that you can use to make your code shorter, cleaner, and readable. by using the framework's powerful features you can always do the same behaviors with shorter code. #laravel 💡💡

thefeqy's tweet image. This is a bunch of options that you can use to make your code shorter, cleaner, and readable.

by using the framework's powerful features you can always do the same behaviors with shorter code.
#laravel 💡💡


Handy 🤩

Sometimes I just need a quick password hash: `php artisan tinker --execute="echo bcrypt('password')" | pbcopy`



Laravel Shots รีโพสต์แล้ว

🔥 Gotta love #PHP 8.0’s null safe operator! Demo: spatie.be/videos/front-l… You can use it instead of @laravelphp’s handy `optional` helper.

freekmurze's tweet image. 🔥 Gotta love #PHP 8.0’s null safe operator!

Demo: spatie.be/videos/front-l…

You can use it instead of @laravelphp’s handy `optional` helper.

Now dispatch jobs from your db transactions without worrying 🔥

One year later and this is now taken care of 💅🏼 laravel.com/docs/8.x/queue…



Laravel Shots รีโพสต์แล้ว

🤓 TIL about the "ping" attribute on <a> tags, which will send a POST request to the given URLs when the anchor is clicked. 🔗 developer.mozilla.org/en-US/docs/Web…

svenluijten's tweet image. 🤓 TIL about the &quot;ping&quot; attribute on &amp;lt;a&amp;gt; tags, which will send a POST request to the given URLs when the anchor is clicked.

🔗 developer.mozilla.org/en-US/docs/Web…

Laravel Shots รีโพสต์แล้ว

🧪 PhpStorm Tips & Tricks #27 - Toggle Search Scope I hope you already know your shortcuts for specific searches. ( files, classes, etc.) One little trick here is if you press the shortcut again it toggles the scope of the search between "Project Files" and "All Files" 🔍


Wait what 🤯🤑

🔥 You may know that you can query against JSON columns using the `column->key` syntax in @laravelphp, but I just learned you can use the same syntax in your tests when asserting that the database has certain data!

jasonlbeggs's tweet image. 🔥 You may know that you can query against JSON columns using the `column-&amp;gt;key` syntax in @laravelphp, but I just learned you can use the same syntax in your tests when asserting that the database has certain data!


🔥🔥🔥

Array destructuring in PHP. 🔥

enunomaduro's tweet image. Array destructuring in PHP. 🔥


TIL 😍

Did you know that you can use array_filter oder collect()->filter() without any arguments to remove empty values? A nice way to quickly get rid of optional data in API requests payloads.

marcelpociot's tweet image. Did you know that you can use array_filter oder collect()-&amp;gt;filter() without any arguments to remove empty values?

A nice way to quickly get rid of optional data in API requests payloads.


So cool @lizziepika⚡️Supercharge your zsh workflow ⚡️


Neat 🧼

Adding a simple `redirectMap` macro to the @laravelphp router can help you clean up your routes file if you have lots of redirects.

aarondfrancis's tweet image. Adding a simple `redirectMap` macro to the @laravelphp router can help you clean up your routes file if you have lots of redirects.


PSA: Laravel <= 8.4.2 has vulnerability (CVE-2021-3129) allowing someone to put a crypto miner on your server if you have DEBUG mode on. reddit.com/r/laravel/comm…


Laravel Shots รีโพสต์แล้ว

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:

JuanDMeGon's tweet image. You need to constantly check if a user is an admin on your Laravel views?

Create an &quot;admin&quot; directive and save some extra lines of code every time:

Laravel Shots รีโพสต์แล้ว

🔥 TIL (or re-learned) that the `pluck` method on a @laravelphp collection accepts a second parameter to specify how you'd like the collection keyed. Super handy in certain cases!

jasonlbeggs's tweet image. 🔥 TIL (or re-learned) that the `pluck` method on a @laravelphp collection accepts a second parameter to specify how you&apos;d like the collection keyed. Super handy in certain cases!

Loading...

Something went wrong.


Something went wrong.