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

Merge pull request #13 from archtechx/week-44

Week 44
This commit is contained in:
Samuel Štancl 2021-11-05 17:37:21 +01:00 committed by GitHub
commit 67c7261982
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
15 changed files with 145 additions and 0 deletions

View file

@ -0,0 +1,5 @@
---
username: AzizullahSamim
name: 'Azizullah Samim'
avatar: 'https://pbs.twimg.com/profile_images/1335270749775540225/TUHwxsQ3_normal.jpg'
---

View file

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

View file

@ -0,0 +1,5 @@
---
username: jbrooksuk
name: 'James Brooks '
avatar: 'https://pbs.twimg.com/profile_images/1450888833168560138/6LhKVmed_normal.jpg'
---

View file

@ -0,0 +1,5 @@
---
username: jessarchercodes
name: 'Jess Archer'
avatar: 'https://pbs.twimg.com/profile_images/1149493363470585858/2aa3eHfK_normal.png'
---

View file

@ -0,0 +1,5 @@
---
username: sharik_709
name: 'Sharik Shaikh'
avatar: 'https://pbs.twimg.com/profile_images/1449051129845714947/XFQAdiQK_normal.jpg'
---

View file

@ -0,0 +1,5 @@
---
username: sky_0xs
name: 'Oussama Sid'
avatar: 'https://pbs.twimg.com/profile_images/1405143897177694210/C-7sXUQ__normal.jpg'
---

View file

@ -0,0 +1,11 @@
---
slug: weekly-thread-2021-44
title: 'Weekly thread #44 of 2021'
tweet_id: '1456649610621902860'
author_username: archtechx
created_at: 2021-11-05T16:04:14+00:00
links: { }
---
🔥 This week's tips for Laravel developers
Lots of great tweets this week, thanks to everyone for posting them! They're helpful to everyone in the community ❤️

View file

@ -0,0 +1,11 @@
---
title: 'Customize the page that users are redirected to after registration, by changing a value in the Fortify config'
tweet_id: '1456649619559968773'
thread_slug: weekly-thread-2021-44
author_username: sharik_709
images:
- 'https://pbs.twimg.com/media/FDGBGv8VEAA3JBZ.jpg'
created_at: 2021-11-05T15:48:27+00:00
slug: customize-the-page-that-users-are-redirected-to-after-registration-by-changing-a-value-in-the-fortify-config
---
When using Jetstream Fortify, If you would like to take the user to a different page after registration instead of the email verifying page. Then you could add an array inside `config/fortify.php` like shown below #Laravel

View file

@ -0,0 +1,14 @@
---
title: 'Use the reset() method to reset properties to their original state in Livewire'
tweet_id: '1456649620918992898'
thread_slug: weekly-thread-2021-44
author_username: sky_0xs
images:
- 'https://pbs.twimg.com/media/FC-XoMFXEAAZGXM.jpg'
created_at: 2021-11-05T15:48:27+00:00
slug: use-the-reset-method-to-reset-properties-to-their-original-state-in-livewire
---
#Laravel Livewire Tip:
If you want to remove property values at once and make your code cleaner, you can use `$this->reset` method.
Here is an example:

View file

@ -0,0 +1,15 @@
---
title: 'Using small integers instead of entire class strings for morph relations can improve their performance'
tweet_id: '1456649615571177476'
thread_slug: weekly-thread-2021-44
author_username: aarondfrancis
images:
- 'https://pbs.twimg.com/media/FDR-ODWXMA0MA5L.jpg'
created_at: 2021-11-05T15:48:26+00:00
slug: using-small-integers-instead-of-entire-class-strings-for-morph-relations-can-improve-their-performance
---
When using Laravel morphs, you can eek out some extra performance by using small integers instead of strings for your morph types.
Smaller, faster indexes for the database to manage!
Especially useful for tables like comments or audits, which can be many millions of rows.

View file

@ -0,0 +1,11 @@
---
title: 'You can create text-based tables in Laravel even outside CLI commands'
tweet_id: '1456649616934404097'
thread_slug: weekly-thread-2021-44
author_username: SteveTheBauman
images:
- 'https://pbs.twimg.com/media/FDR9jFzXsAICBd9.jpg'
created_at: 2021-11-05T15:48:26+00:00
slug: you-can-create-text-based-tables-in-laravel-even-outside-cli-commands
---
If you ever need to generate text-based tables for sending in text messages, outputting in console, or in logs, @symfony provides an awesome "Table" class, just for that! 💅 Such a cool utility! 🤩

View file

@ -0,0 +1,11 @@
---
title: 'You can use ternary operators like ?: to use dump() or dd() in your short closures'
tweet_id: '1456649618205261824'
thread_slug: weekly-thread-2021-44
author_username: jessarchercodes
images:
- 'https://pbs.twimg.com/media/FDOw-QKUUAEbXLw.jpg'
created_at: 2021-11-05T15:48:26+00:00
slug: you-can-use-ternary-operators-like-to-use-dump-or-dd-in-your-short-closures
---
Do you hate re-writing short closures just to add temporary debugging code?

View file

@ -0,0 +1,12 @@
---
title: 'You can use value() to fetch a single value from the database, without having to instantiate an entire model'
tweet_id: '1456649611796369411'
thread_slug: weekly-thread-2021-44
author_username: AzizullahSamim
images:
- 'https://pbs.twimg.com/media/FDL2wc2XMAYoIXr.jpg'
created_at: 2021-11-05T15:48:25+00:00
slug: you-can-use-value-to-fetch-a-single-value-from-the-database-without-having-to-instantiate-an-entire-model
---
#Laravel Tip:
If you want a single value from a database table.

View file

@ -0,0 +1,19 @@
---
title: 'You can use valueOrFail() to fetch a value from the database, or abort the request if the queried record does not exist'
tweet_id: '1456649612966576129'
thread_slug: weekly-thread-2021-44
author_username: pascalbaljet
images:
- 'https://pbs.twimg.com/media/FC7vZ2oX0AIV4fG.jpg'
created_at: 2021-11-05T15:48:25+00:00
slug: you-can-use-valueorfail-to-fetch-a-value-from-the-database-or-abort-the-request-if-the-queried-record-does-not-exist
---
In the next blog posts, I'll cover Database and Eloquent improvements and new features in #Laravel 8.x.
Here's a great little feature that got added in v8.60 🔥
PR: https://github.com/laravel/framework/pull/38707
Yesterday's post about Collections: https://protone.media/en/blog/a-look-at-new-features-and-improvements-since-the-original-laravel-80-release-collections
#PHP #webdev #opensource

View file

@ -0,0 +1,11 @@
---
title: 'You can use ->where() on Rule instances without passing a callback'
tweet_id: '1456649614300356615'
thread_slug: weekly-thread-2021-44
author_username: jbrooksuk
images:
- 'https://pbs.twimg.com/media/FDDdhwiXEAIY4vZ.jpg'
created_at: 2021-11-05T15:48:25+00:00
slug: you-can-use-where-on-rule-instances-without-passing-a-callback
---
Did you know that you don't have to pass a function to Laravel's "where" method when using the Rule class?