Eloquent's `is()` method
?? Use Eloquent's "->is()" method for more expressive and thorough assertions pic.twitter.com/8zx8AEm9Rw
— Caleb Porzio (@calebporzio) 22 juni 2018
?? Use Eloquent's "->is()" method for more expressive and thorough assertions pic.twitter.com/8zx8AEm9Rw
— Caleb Porzio (@calebporzio) 22 juni 2018
?♂️So you think that code always flows through either the if or else branch in a PHP script?
— Freek Van der Herten (@freekmurze) June 13, 2018
Hold my ?
----
<?php$pid = pcntl_fork();
if ($pid) {
echo 'in if';
}
else {
echo 'in else';
}
----
Try it out!#processcontrol #fun
Join thousands of developers
Every two weeks, I share practical tips, tutorials, and behind-the-scenes insights from maintaining 300+ open source packages.
No spam. Unsubscribe anytime. You can also follow me on X.
? Super simple clean-up, but the cause of so much "dead code". When using `return` statements within a `switch` block the `break` is unnecessary and is always unnecessary for the `default` case. pic.twitter.com/QxjFmiGcYy
— Jason McCreary (@gonedark) June 11, 2018
? Killing conditionals with Eloquent's "firstOr" method. If firstOrCreate, firstOrFail, or firstOrNew don't quite cut it. pic.twitter.com/PKrtqDc0vl
— Caleb Porzio (@calebporzio) 22 mei 2018
? Laravel Quick Tip: Did you know that you can change the keys of a collection to a given value of the collection? ? Perfect for removing items of a collection by the model id. #laravel pic.twitter.com/kgsVnkFCBe
— Christoph Rumpel (@christophrumpel) 24 mei 2018
? When linking to a file on @github, press 'y' to transform the URL to a SHA-based reference. That way, the link will remain stable even if the underlying file changes in future commits. pic.twitter.com/cAsupEk7tV
— Derrick Reimer (@derrickreimer) 30 mei 2018
? Did you know you could use the afterCreating and lots of other "after" callbacks on Eloquent Factories to create additional models in Laravel? https://t.co/XejFph55zO #Laravel #PHP pic.twitter.com/oc8BfpEPqN
— Dries Vints (@driesvints) May 15, 2018
?? Little component I made if you want to submit data (including JSON!!) from your Vue components in native HTML forms.https://t.co/FSdiuhJLmA pic.twitter.com/pF9Gb6BYRD
— Caleb Porzio (@calebporzio) May 2, 2018
My favorite Laravel feature: `higher order tap`. So simple, yet so powerful. ? pic.twitter.com/cfBU4i0zk7
— Raul (@rcubitto) May 2, 2018
⏲️ Handy eloquent macro for the date comparison impaired ? pic.twitter.com/rUgLlEywrn
— Caleb Porzio (@calebporzio) April 25, 2018
If you want to quickly inspect a return value, you can use tap + logger without adding a variable! #laravel pic.twitter.com/TXA02BYlaC
— Sebastian De Deyne (@sebdedeyne) April 27, 2018
? Handy lil testing macro for getting data from views pic.twitter.com/50dn2jCfSy
— Caleb Porzio (@calebporzio) March 30, 2018
? Quick Tip for @laravelphp: It's easy to show Horizon metrics somewhere else. pic.twitter.com/SIUfwfAsKX
— hans ? (@hanspagel) March 27, 2018
#30daysWithEloquent customize relations on your models as necessary in your domain. Don't be afraid to add more relations that describe your logic better.
— DRY, DRY, DRY, DRY (@SOFTonSOFA) February 22, 2018
With @laravelphp it's a cinch ??? pic.twitter.com/m3TJXp9C2l
In case you have a one off section of code where you don't want to change the timestamps on save. #laraveltips pic.twitter.com/1XMwNwQNIz
— Eric L. Barnes (@ericlbarnes) March 11, 2018
Blade components are pretty cool for scoped-slot-like stuff when you're not in a JS environment pic.twitter.com/pjp4ycOPKm
— Sebastian De Deyne (@sebdedeyne) March 2, 2018
? Fun tip: Use tap() in lodash chains for a window into your transformations ? pic.twitter.com/aF11Tlzuz7
— Caleb Porzio (@calebporzio) February 20, 2018
? Ever wanted to use the same controller to serve multiple formats?
— Adam Wathan (@adamwathan) February 15, 2018
Check out this set of macros that let you hit a single endpoint with different extensions to request the format you want:https://t.co/2sFGNf97be pic.twitter.com/HMNdicUWAy
?? Here's what it looks like in use: pic.twitter.com/zHo0GlAU6w
— Adam Wathan (@adamwathan) February 15, 2018
Quick @laravelphp tip:
— Marcel Pociot (@marcelpociot) January 6, 2018
Use the "wasRecentlyCreated" model attribute to check if your model was created or found ???? pic.twitter.com/HZwdDyqAw4
???? Sometimes you want quick on-the-fly authorization, without the hassle of registering a policy/callback at the Gate.
— Joseph Silber (@joseph_silber) December 28, 2017
Laravel's HandlesAuthorization trait is perfect for this. Simply call the `deny()` method, and Laravel will respond with a 403 HTTP response ???? pic.twitter.com/O36agH2o3u