1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 05:14:04 +00:00

Add weekly thread #3 (#25)

This commit is contained in:
lukinovec 2022-01-21 18:22:44 +01:00 committed by GitHub
parent 0e34bd3779
commit f1e283e142
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 160 additions and 3 deletions

View file

@ -0,0 +1,11 @@
---
title: 'Array destructuring in PHP is very powerful, yet still underutilized'
tweet_id: '1484566707133825024'
thread_slug: weekly-thread-2022-03
author_username: aschmelyun
images:
- 'https://pbs.twimg.com/media/FJg9H52X0AYdyL3.jpg'
created_at: 2022-01-21T16:40:59+00:00
slug: array-destructuring-in-php-is-very-powerful-yet-still-underutilized
---
Array destructuring is probably one of my favorite things in modern PHP and I don't think I use it enough

View file

@ -0,0 +1,16 @@
---
title: 'Interesting technique: add getters to Form Requests'
tweet_id: '1484566716403183617'
thread_slug: weekly-thread-2022-03
author_username: mmartin_joo
images:
- 'https://pbs.twimg.com/media/FJYsa1fXMAQQlEr.jpg'
created_at: 2022-01-21T16:41:01+00:00
slug: interesting-technique-add-getters-to-form-requests
---
💪Power up your #Laravel requests
You can add very simple getters on the request, so:
✅You actually know what's on the request
✅You have types
✅You can do basic data transformation

View file

@ -0,0 +1,11 @@
---
title: 'Laravel''s Http client supports concurrent requests using the `pool` method'
tweet_id: '1484566722526924801'
thread_slug: weekly-thread-2022-03
author_username: mattkingshott
images:
- 'https://pbs.twimg.com/media/FJdr42eWQAcEVKh.jpg'
created_at: 2022-01-21T16:41:03+00:00
slug: laravels-http-client-supports-concurrent-requests-using-the-pool-method
---
🔥 #Laravel Tip: Need to make more than one HTTP request e.g. to one or more sites? You might think about running them concurrently to improve performance. The HTTP client's 'pool' method makes this a trivial exercise.

View file

@ -0,0 +1,11 @@
---
title: 'Laravel''s Slack logging channel is fully compatible with Discord'
tweet_id: '1484566698069876740'
thread_slug: weekly-thread-2022-03
author_username: LarsKlopstra
images:
- 'https://pbs.twimg.com/media/FJjSoysWUAI-HBq.jpg'
created_at: 2022-01-21T16:40:57+00:00
slug: laravels-slack-logging-channel-is-fully-compatible-with-discord
---
🤖🧠 Want to log errors or user activity to Discord? You can use the Slack driver to send Slack compatible webhooks to Discord!

View file

@ -0,0 +1,13 @@
---
title: 'Make Laravel send all emails to a specific email address using Mail::alwaysTo()'
tweet_id: '1484566719574130689'
thread_slug: weekly-thread-2022-03
author_username: fideloper
images:
- 'https://pbs.twimg.com/media/FJkqAzmXMAA5tlg.jpg'
created_at: 2022-01-21T16:41:02+00:00
slug: make-laravel-send-all-emails-to-a-specific-email-address-using-mailalwaysto
---
Just got schooled in a Laravel feature I was unaware of:
Tell Laravel to always send to a specific address!

View file

@ -0,0 +1,15 @@
---
title: 'Make models prunable to periodically delete them from the DB'
tweet_id: '1484566701089849344'
thread_slug: weekly-thread-2022-03
author_username: mmartin_joo
images:
- 'https://pbs.twimg.com/media/FJTZyx9XEAcctdk.jpg'
created_at: 2022-01-21T16:40:58+00:00
slug: make-models-prunable-to-periodically-delete-them-from-the-db
---
💡#Laravel Eloquent Tip
Laravel 8 introduced the Prunable trait. You can use it to delete old models on a scheduled basis.
You don't need to write custom commands anymore:

View file

@ -0,0 +1,17 @@
---
title: 'MySQL has a blackhole store engine'
tweet_id: '1484566725597138944'
thread_slug: weekly-thread-2022-03
author_username: fideloper
images:
- 'https://pbs.twimg.com/media/FJklJacX0AIsUP1.jpg'
created_at: 2022-01-21T16:41:03+00:00
slug: mysql-has-a-blackhole-store-engine
---
👨‍🔬 Cool MySQL hack:
🧐 If your staging env has a table that ideally doesn't have data in it (esp production data)
🕳 You can make it a BLACKHOLE table
😅 I used this to make sure a table with a list of emails to send never contains any rows. Because, you know....

View file

@ -0,0 +1,15 @@
---
title: 'Specify the columns you want to select when fetching all() models'
tweet_id: '1484566713303584774'
thread_slug: weekly-thread-2022-03
author_username: bhaidar
images:
- 'https://pbs.twimg.com/media/FI-ea7zUcAIf9z3.jpg'
created_at: 2022-01-21T16:41:01+00:00
slug: specify-the-columns-you-want-to-select-when-fetching-all-models
---
🌶️ #Laravel tip: You can select the columns to run when using the Model::all() method. No need for an additional select() method.
A tiny tip to always keep in mind 💡
#PHP #Developers

View file

@ -0,0 +1,11 @@
---
title: 'Use Laravel''s task scheduler to run CLI commands — including shell scripts — at regular intervals'
tweet_id: '1484566710313054208'
thread_slug: weekly-thread-2022-03
author_username: mattkingshott
images:
- 'https://pbs.twimg.com/media/FJYySaNXIBA4lPW.jpg'
created_at: 2022-01-21T16:41:00+00:00
slug: use-laravels-task-scheduler-to-run-cli-commands-including-shell-scripts-at-regular-intervals
---
🔥 #Laravel Tip: The task scheduler is not limited to just commands. You can configure it to dispatch jobs and even execute shell scripts at regular intervals.

View file

@ -0,0 +1,11 @@
---
title: 'You can name migrations "like this"'
tweet_id: '1484566704172634120'
thread_slug: weekly-thread-2022-03
author_username: mvpopuk
images:
- 'https://pbs.twimg.com/media/FJUAG2WXoAU2q_f.jpg'
created_at: 2022-01-21T16:40:58+00:00
slug: you-can-name-migrations-like-this
---
🔥 Epic Laravel Tip - Did you know that you don't necessarily have to use underscores for migrations names?