mirror of
https://github.com/archtechx/laravel-tips.git
synced 2025-12-12 05:14:04 +00:00
Add new tips thread
This commit is contained in:
parent
0255a607fb
commit
b41c692353
15 changed files with 145 additions and 0 deletions
|
|
@ -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
|
||||
|
|
@ -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:
|
||||
|
|
@ -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.
|
||||
|
|
@ -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! 🤩
|
||||
|
|
@ -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-gtwhere-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?
|
||||
|
|
@ -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?
|
||||
|
|
@ -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.
|
||||
|
|
@ -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
|
||||
Loading…
Add table
Add a link
Reference in a new issue