{ Laravel snippets }

Laravel's magic can sometimes be counterproductive when auto-completion stops working. Model resources are a great example, where `$this->` can access the model's properties. @sebdedeyne gave me the great tip to use the `mixin` docblock to solve that issue! https://t.co/VQpX4HmsIl

Simon Kollross

Simon Kollross @skollro

๐Ÿ”ฅ Want to use cascading deletes/updates at database level but you've forgot to add them in your inital migrations? Just recreate the foreign keys in a new #Laravel migration ๐Ÿ‘๐Ÿป https://t.co/dcuB2SOT1O

Caleb Porzio

Caleb Porzio @calebporzio

๐Ÿ‘จโ€๐ŸŽจ Laravel's kinda-new-kinda-old request()->validate() method doubling as request()->only() is just sooo good Tell me this isn't beautiful! https://t.co/rP6QfEInxR

Caleb Porzio

Caleb Porzio @calebporzio

๐Ÿ‘จโ€๐Ÿซ๐Ÿ‘จโ€๐ŸŒพ Did you know you can alias your blade components so they look like custom blade directives? So clean โœจ https://t.co/j97YufGDlR

I was trying to call an artisan command from within a migration, but I wasn't getting any output to the console ๐Ÿค” ... Turns out, the default output is not the console with Artisan::call(). You have to change this behavior by injecting a different output class. ๐Ÿค #Laravel https://t.co/COtEnCbSZv

Jesse Schutt ๐Ÿ’ฌ

Jesse Schutt ๐Ÿ’ฌ @jesseschutt

If your test is failing and you're pretty sure it shouldn't be, try adding "->fresh()" to the model under assertion. Chances are the assertion is failing due to creation properties such as "wasRecentlyCreated" on the original model. #laravelphp #testing https://t.co/8H8am3oxxW

Joseph Silber

Joseph Silber @joseph_silber

๐Ÿ”ฅ The "optional" helper in @laravelphp is great for safely calling a method on an object that could be null. But what if the method is not on the actual object itself? Well now you can pass in a closure to "optional", and it'll only call it if the given object is not null ๐Ÿ’ฏ https://t.co/0RIbUffuOY