{ Laravel snippets }

Barry vd. Heuvel

Barry vd. Heuvel @barryvdh

With the new Telescope release, you can easily send Slack notifications for Exceptions with a direct link to Telescope, using the new Telescope::afterStoring() hook. Makes it even easier to track down the context of the error ๐Ÿ’ก https://t.co/wTKwcloN44 https://t.co/uC2Pq6Qbgh

Liam Hammett

Liam Hammett @LiamHammett

๐Ÿ”ฅ I often find myself keeping validation rules in a method on the model. This lets me reuse them wherever I may need - including in controllers or form requests. https://t.co/QDjYFEN2vM

Andrew Schmelyun

Andrew Schmelyun @aschmelyun

Me: *dreads having to rename a database table in my code* Laravel documentation:โœจ It's just Schema::rename('old_name', 'new_name') my dude โœจ

Laravel Daily

Laravel Daily @DailyLaravel

#Laravel tip of the day: if you want to have active/inactive (or, in other words, banned/suspended) users in your database, just add this method into your LoginController, it will act like a Middleware. https://t.co/BiMhzFIElF

Jason McCreary

Jason McCreary @gonedark

๐Ÿ”ฅ Controllers often have the most code as they contain all the business logic. By leveraging native components and expressive methods, we can streamline our controllers while also improving readability. A huge win. Here are some examples of reducing common blocks of code: https://t.co/ZCZXG4iAqa

Jason Beggs

Jason Beggs @jasonlbeggs

๐Ÿ”ฅ Reminder: When testing with Laravel, you can use the from() method to automatically set a referer url. This allows you to test redirects that use the redirect()->back() helper. https://t.co/1ny0hrAY2c

Stefan Bauer

Stefan Bauer @stefanbauerme

๐ŸŒŸ I'm working on a little feature at the moment and I thought it might be worth sharing. Another tip when you need to work with time intervals and seconds. Using `CarbonInterval` makes it much more readable. https://t.co/ktpNR7BoKY

Taylor Otwell ๐Ÿ

Taylor Otwell ๐Ÿ @taylorotwell

This is something I don't think we document well enough. If you prefer a "Models" directory... you can do things like php artisan make:policy PhotoPolicy --model=Models/Photo.... php artisan make:model Models/Photo... etc. All works fine! ๐Ÿฅฐ https://t.co/ZykVwAbpgH

Paul Redmond ๐Ÿ‡บ๐Ÿ‡ธ

Paul Redmond ๐Ÿ‡บ๐Ÿ‡ธ @paulredmond

๐Ÿ”ฅ If you want to make assertions on JSON returned from Laravel's API Resources, get the values wrapped in {'data': {}} by passing the 'data' key: https://t.co/y0CAIfYIW1

Rias Van der Veken

Rias Van der Veken @Riasvdv

๐Ÿ”ฅ Don't want Laravel Mix complaining about the manifest during your CI tests and don't want to compile them to save time? Add this to your base TestCase https://t.co/Yuip8vL6cq

Hey Future Jake ๐Ÿ‘‹ ๐Ÿค“ Need to create a large file full of random stuff on the command line? dd to the rescue! dd if=/dev/urandom of=file.txt bs=1048576 count=100 The last number is the approximate final file size in MB. https://t.co/810bh0hEZp