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

Week 9 of 2022

This commit is contained in:
Samuel Štancl 2022-03-06 19:20:10 +01:00
parent 7492f1b9cf
commit 796acab2e2
10 changed files with 1343 additions and 1011 deletions

2267
composer.lock generated

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,5 @@
---
username: avosalmon
name: 'Ryuta Hamasaki'
avatar: 'https://pbs.twimg.com/profile_images/1483465394862301195/41WCb6-A_normal.jpg'
---

View file

@ -0,0 +1,5 @@
---
username: danjharrin
name: 'Dan Harrin 🦒'
avatar: 'https://pbs.twimg.com/profile_images/1438071617045901316/2jc7vDE7_normal.jpg'
---

View file

@ -0,0 +1,5 @@
---
username: itsmarkmead
name: 'Mark Mead'
avatar: 'https://pbs.twimg.com/profile_images/1425351075054379010/qypNHjGY_normal.jpg'
---

View file

@ -0,0 +1,11 @@
---
slug: weekly-thread-2022-09
title: 'Weekly thread #09 of 2022'
tweet_id: '1499806895242039297'
author_username: archtechx
created_at: 2022-03-04T18:00:03+00:00
links: { }
---
🔥 This week's code tips for Laravel developers
A weekly thread 🧵

View file

@ -0,0 +1,11 @@
---
title: 'Be careful about setting timezones with Carbon'
tweet_id: '1499806898136117248'
thread_slug: weekly-thread-2022-09
author_username: freekmurze
images:
- 'https://pbs.twimg.com/media/FMwTTWZXsAUfgHT.jpg'
created_at: 2022-03-04T18:00:04+00:00
slug: be-careful-about-setting-timezones-with-carbon
---
❗️⏰ When working with Carbon/timezones, you should be aware that setting the timezone during construction is not the same as altering the timezone later. 👍

View file

@ -0,0 +1,13 @@
---
title: 'Use Carbon''s setTimezone() and shiftTimezone() methods'
tweet_id: '1499806904515584001'
thread_slug: weekly-thread-2022-09
author_username: danjharrin
images:
- 'https://pbs.twimg.com/media/FMw6UNgXMAYuWrS.jpg'
created_at: 2022-03-04T18:00:05+00:00
slug: use-carbons-settimezone-and-shifttimezone-methods
---
Over the past few years, I've worked on some large apps that deal with events in different timezones. This can end up being quite confusing, as best practice is always to store dates in UTC.
That's where Carbon's `shiftTimezone()` and `setTimezone()` methods can help you out! ⬇️

View file

@ -0,0 +1,11 @@
---
title: 'Use the stream() method to send a file to the browser without triggering a download'
tweet_id: '1499806901390827523'
thread_slug: weekly-thread-2022-09
author_username: avosalmon
images:
- 'https://pbs.twimg.com/media/FMwQ4iQaUAIpajf.jpg'
created_at: 2022-03-04T18:00:05+00:00
slug: use-the-stream-method-to-send-a-file-to-the-browser-without-triggering-a-download
---
#Laravel Tip 🔥 If you want to return a file content without initiating a download, you can use the stream() method. It will display the file in the browser.

View file

@ -0,0 +1,13 @@
---
title: 'Use the updateExistingPivot() method to make changes to pivot columns on existing records'
tweet_id: '1499806907522961408'
thread_slug: weekly-thread-2022-09
author_username: mmartin_joo
images:
- 'https://pbs.twimg.com/media/FMsTKxEXIAICDNY.jpg'
created_at: 2022-03-04T18:00:06+00:00
slug: use-the-updateexistingpivot-method-to-make-changes-to-pivot-columns-on-existing-records
---
💡If you have a many-to-many relationship with a pivot table and extra columns, you can use the updateExistingPivot to update the extra column's value.
In this example, I need to update the status of a given subscriber:

View file

@ -0,0 +1,13 @@
---
title: 'Use `::` to use Alpine property binding inside Blade templates'
tweet_id: '1499806910886789121'
thread_slug: weekly-thread-2022-09
author_username: itsmarkmead
images:
- 'https://pbs.twimg.com/media/FM8JgUHXIAgj5Vl.jpg'
created_at: 2022-03-04T18:00:07+00:00
slug: use-to-use-alpine-property-binding-inside-blade-templates
---
TIL: You can pass Alpine JS data to Blade components by using `::`
#laravel