1
0
Fork 0
mirror of https://github.com/archtechx/laravel-tips.git synced 2025-12-12 13:24:03 +00:00

Weekly thread #5

This commit is contained in:
lukinovec 2022-02-17 17:18:25 +01:00
parent eebf38f267
commit 622cb93b73
13 changed files with 135 additions and 1 deletions

View file

@ -1,5 +1,5 @@
---
username: aarondfrancis
avatar: 'https://pbs.twimg.com/profile_images/1492165477161914369/bXZG72Li_normal.jpg'
name: 'Aaron Francis'
avatar: 'https://pbs.twimg.com/profile_images/1433075605784997889/-Smrc71W_normal.jpg'
---

View file

@ -0,0 +1,5 @@
---
username: alanrezende
name: 'Alan Rezende'
avatar: 'https://pbs.twimg.com/profile_images/1404889748896993288/R7HpEXS9_normal.jpg'
---

View file

@ -0,0 +1,5 @@
---
username: warsh33p
name: 'Kai Sassnowski 🥔'
avatar: 'https://pbs.twimg.com/profile_images/1471470755355443210/pCy5acDI_normal.jpg'
---

View file

@ -0,0 +1,11 @@
---
slug: weekly-thread-2022-05
title: 'Weekly thread #05 of 2022'
tweet_id: '1489620159585153026'
author_username: archtechx
created_at: 2022-02-17T16:16:06+00:00
links: { }
---
🔥 This week's code tips for Laravel developers
A weekly thread 🧵

View file

@ -0,0 +1,17 @@
---
title: 'Laravel provides a `Fluent` class as a universal structure for array data'
tweet_id: '1489620180086902792'
thread_slug: weekly-thread-2022-05
author_username: cerbero90
images:
- 'https://pbs.twimg.com/media/FKcMWbwacAICnCw.png'
created_at: 2022-02-04T15:21:41+00:00
slug: laravel-provides-a-fluent-class-as-a-universal-structure-for-array-data
---
Fluent is a utility class provided by @laravelphp that lets us handle data fluently.
Out of the box it can be turned into an array or JSON, it can act as an array and it's serializable as a JSON.
It also gets and sets attributes dynamically and in a fluent way.
#Laravel #PHP

View file

@ -0,0 +1,15 @@
---
title: 'match() statements are a great way to clean up code'
tweet_id: '1489620168233734144'
thread_slug: weekly-thread-2022-05
author_username: cerbero90
images:
- 'https://pbs.twimg.com/media/FKqzQ68aMAAqGdX.png'
created_at: 2022-02-04T15:21:38+00:00
slug: match-statements-are-a-great-way-to-clean-up-code
---
Match offers such a compact and clean syntax compared to its PHP alternatives 🌈
It can make our code way more readable and concise 💅
#PHP

View file

@ -0,0 +1,11 @@
---
title: 'You can add this Tailwind plugin to generate child-selector variants'
tweet_id: '1489620177071210497'
thread_slug: weekly-thread-2022-05
author_username: warsh33p
images:
- 'https://pbs.twimg.com/media/FKaHaf9XsAQzC_0.jpg'
created_at: 2022-02-04T15:21:40+00:00
slug: you-can-add-this-tailwind-plugin-to-generate-child-selector-variants
---
🔥 Since Im having to deal with a lot of generated markup recently, this small child-selector plugin for Tailwind has been a life saver.

View file

@ -0,0 +1,11 @@
---
title: 'You can disable lazy loading using Model::preventLazyLoading()'
tweet_id: '1489620165201330177'
thread_slug: weekly-thread-2022-05
author_username: mattkingshott
images:
- 'https://pbs.twimg.com/media/FKlnRQ_XwAUqAxB.jpg'
created_at: 2022-02-04T15:21:37+00:00
slug: you-can-disable-lazy-loading-using-modelpreventlazyloading
---
🔥 #Laravel Tip: Protect your database from the dangers of lazy loading by disabling it in your Laravel app. You can also customise how violations are handled, which is perfect for models outside of your control e.g. within packages.

View file

@ -0,0 +1,11 @@
---
title: 'You can replace Laravel''s stubs to customize files generated using artisan commands'
tweet_id: '1489620183085768706'
thread_slug: weekly-thread-2022-05
author_username: mattkingshott
images:
- 'https://pbs.twimg.com/media/FKbBGYpXIAACsW8.jpg'
created_at: 2022-02-04T15:21:42+00:00
slug: you-can-replace-laravels-stubs-to-customize-files-generated-using-artisan-commands
---
🔥 #Laravel Tip: If you find yourself constantly making changes to new files generated by Artisan's 'make' commands, then consider publishing the stubs and creating your own defaults. It can be a real time saver:

View file

@ -0,0 +1,13 @@
---
title: 'You can swap multiple keywords in a string using this macro'
tweet_id: '1489620174093176833'
thread_slug: weekly-thread-2022-05
author_username: aarondfrancis
images:
- 'https://pbs.twimg.com/media/FKd_FZRXsAEgBjK.jpg'
created_at: 2022-02-04T15:21:39+00:00
slug: you-can-swap-multiple-keywords-in-a-string-using-this-macro
---
This is one of those macros I carry around from project to project.
Super clear, super easy, nice little life improvement.

View file

@ -0,0 +1,11 @@
---
title: 'You can track logins and logouts for auditing purposes using Laravel''s native auth events'
tweet_id: '1489620171241050112'
thread_slug: weekly-thread-2022-05
author_username: mattkingshott
images:
- 'https://pbs.twimg.com/media/FKlsjn1WQAU_Xg2.jpg'
created_at: 2022-02-04T15:21:39+00:00
slug: you-can-track-logins-and-logouts-for-auditing-purposes-using-laravels-native-auth-events
---
🔥 #Laravel Tip: Tracking logins and logouts for auditing or security purposes is incredibly easy thanks to Laravels login and logout events. Simply listen for them in a service provider and respond when they are fired.

View file

@ -0,0 +1,11 @@
---
title: 'You can use the getCollection() and setCollection() methods on the paginator to interact with the underlying data'
tweet_id: '1489620186109857800'
thread_slug: weekly-thread-2022-05
author_username: alanrezende
images:
- 'https://pbs.twimg.com/media/FKngV3LWQAQcft4.png'
created_at: 2022-02-04T15:21:42+00:00
slug: you-can-use-the-getcollection-and-setcollection-methods-on-the-paginator-to-interact-with-the-underlying-data
---
🔥 #Laravel paginator tip: you can use getCollection and setCollection if you need to do something to the paginator underlying data. Trust me you'll know when you need this.

View file

@ -0,0 +1,13 @@
---
title: 'You can use the new Str::transliterate() helper to convert a string to its closest ASCII representation'
tweet_id: '1489620162357579778'
thread_slug: weekly-thread-2022-05
author_username: freekmurze
images:
- 'https://pbs.twimg.com/media/FKmRs46XsAA85Bh.jpg'
created_at: 2022-02-04T15:21:37+00:00
slug: you-can-use-the-new-strtransliterate-helper-to-convert-a-string-to-its-closest-ascii-representation
---
Pretty cool string helper method
https://laravel-news.com/laravel-8-82-0
#laravel #php