The Laravel and the Vue.js online communities are very good at sharing code snippets over on Twitter. I had a whole pile of these examples loaded in tabs on my phone. I would rather share them here on this journal for future reference. Enjoy.
Using @laravelphp Blade with a lot of JS Variables? πUse π the π @verbatim π directive!! pic.twitter.com/mm8sPdQn1S
— Brad Madigan (@bmadigan) August 22, 2017
Dove into @laravelphp core to see if I could use "only" fluently and stumbled upon a few other, helpful Route methods. Why yes I canβ¦ π pic.twitter.com/Jxg3mWAfBJ
— Jason McCreary (@gonedark) August 31, 2017
I wish I had known this was possible earlier in my career.
— Mohamed Said (@themsaid) September 6, 2016
Time travelling using Carbon. pic.twitter.com/hLMg5EAD6B
Nice hidden @laravelphp Eloquent feature: you can specify the columns to eager load directly in the 'with' call! pic.twitter.com/vQT8CaRqGC
— Stidges (@stidges) September 13, 2017
If you use Sublime, here are useful keyboard shortcuts (macOS) for line manipulationβsome common ones but many unknown that may be helpful pic.twitter.com/OLm0QeLtIq
— Jonathan Suh (@jonsuh) September 13, 2017
πv1.0.0 of laravel-stats has been released. Go and start analyze your project now! https://t.co/KfvhRyfgMe pic.twitter.com/4yQRszZv9r
— Stefan Zweifel (@_stefanzweifel) October 20, 2017
π€ Little trick to use Laravel's awesome json assertions against json from any source (external url, test fixture, etc..) pic.twitter.com/c7YDJ0jn8a
— Caleb Porzio (@calebporzio) November 16, 2017
π₯ Lots of places in Laravel that accept callbacks will also accept a dot-notation string.
— Adam Wathan (@adamwathan) November 16, 2017
Perfect when you're just doing something simple and PHP's verbose closures are making you sad ππ» pic.twitter.com/kkKRfKKiQi
Went ahead and added both of these for Laravel 5.6 πββοΈ pic.twitter.com/tLLKVSRSQe
— Taylor Otwell βοΈ (@taylorotwell) December 1, 2017
Tip: if you are on #Laravel 5.5 and enjoy Carbon, be sure to use Illuminate\Support\Carbon instead of \Carbon\Carbon. It's a wrapper class, 100% macroable, and allows you to set a custom json serializer. π pic.twitter.com/mE8xbpYrAu
— Raul (@rcubitto) December 20, 2017
π₯ 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
π Leveraging Spark events and our activitylog package to keep an eye on what's happing on @OhDearApp π
— Freek Van der Herten (@freekmurze) December 29, 2017
Activitylog: https://t.co/9YHTQc6eVj
Team events: https://t.co/SUFlq6gtE9 pic.twitter.com/m4JxiAR0vu
π₯ If you ever seed your Vue components with JSON data in your Blade templates, you *definitely* want to enable double-encoding.
— Adam Wathan (@adamwathan) January 19, 2018
Without it, a rogue """ in any user-submitted data might blow up your front end! pic.twitter.com/kifQ3ksv6H
π₯ Instead of naming your Vue transitions, try combining the default `v-{enter/leave}` classes with separate classes for each enter and leave style.
— Adam Wathan (@adamwathan) January 23, 2018
It's much easier to compose different enter/leave transitions on the fly without a new class for every combination ππ» pic.twitter.com/097FSL4ZYh
π₯ @vuejs components can be a lot more than just UI widgets!
— Adam Wathan (@adamwathan) January 25, 2018
Check out this demo of a "fetch" component for making AJAX requests from your markup:https://t.co/ysBUU1bLUN
Inspired by a conversation with @youyuxi yesterday! π pic.twitter.com/eVErHL1S2O
Basecamp 3 is up to 308 controllers. Some 1400 methods. Imagine recreating all that with all-native apps? No thanks. Majestic be thy Monolith. pic.twitter.com/aTmwGT32ep
— DHH (@dhh) February 9, 2018
π You can make use of @laravelphp's auth "intended" function by just adding a value to the right session key.
— Chris Fidao (@fideloper) February 17, 2018
Free "redirect me back to the correct place after login" behavior! pic.twitter.com/sCbuHhIWK0
π₯ Ever run into annoying CSS layout bugs that are really hard to troubleshoot? (WHY IS THERE A HORIZONTAL SCROLLBAR WHERE IS THIS COMING FROM?!?)
— Adam Wathan (@adamwathan) February 1, 2018
Throw this style into your dev tools to quickly see the boundaries of every element without affecting the layout: pic.twitter.com/Qwc2Ic2fV5
This is very sweet π@laravelphp allows you to hook into the __construct() method of a model from a trait by implementing the initialize{TraitName} method.
— Tim MacDonald (@timacdonald87) December 21, 2018
Excuse the rather long example, but it is worth it. pic.twitter.com/FcI8shvRvq
#Laravel tip of the day: if you want to find out which of your composer.json packages have released newer versions, just run "composer outdated". You will get a full list with all information. pic.twitter.com/2FOw39TBr4
— Laravel Daily (@DailyLaravel) March 6, 2019