Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the new features of Laravel 6.11?

2025-04-03 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >

Share

Shulou(Shulou.com)06/01 Report--

This article mainly introduces what the new features of Laravel 6.11 are, which can be used for reference by interested friends. I hope you can learn a lot after reading this article.

The official development team of Laravel released version 6.11.0 of Laravel this week, which adds the firstWhere method to Eloquent model queries, optimizes Redis-based multi-channel broadcasting, and fixes problems in some existing versions.

Let's first take a look at the new features in this release.

1. New function Eloquent firstWhere () method

The Eloquent model now supports calling the firstWhere method, which has the same effect as where ()-> first (), and is a syntactic sugar:

/ / call User::where ('emaill',' foo@bar.com')-> first () like this before

/ / you can now call User::firstWhere ('email',' foo@bar.com') like this

It is important to note that this method is only available in Eloquent model queries and not in database query builders.

Optimize Redis multi-channel broadcasting

In Laravel applications, it is common to send events to multiple channels at a time. At present, our practice is to send exactly the same load data to the specified Redis server through multiple release commands, which will lead to unnecessary data transmission, resulting in communication and performance losses, especially when the load data is very large.

So, the latest version of Laravel optimizes this problem by adding a Lua script to RedisBroadcaster that allows data to be broadcast to multiple channels at a time:

2. Update the log

Next, let's take a look at the detailed log of this version update.

New features

Add Illuminate\ Database\ Eloquent\ Builder::firstWhere () method

Redis supports broadcasting data to multiple channels at once.

Problem repair

Fix undefined attributes in WithFaker::makeFaker ()

Fix the Str::afterLast () method

Fixed the problem of PHP 7.3 inserting floating-point types into MySQL database

Fixed the problem of refreshing the model by customizing the attribute name of the intermediate table

Code adjustment

Remove all indents in the Blade template

Add mailing names to assertion messages in MailFake::assertNothingSent () and MailFake::assertNothingQueued ()

Search for similar results in assertDatabaseHas ()

Thank you for reading this article carefully. I hope the article "what are the new features of Laravel 6.11" shared by the editor will be helpful to you. At the same time, I also hope you will support us and pay attention to the industry information channel. More related knowledge is waiting for you to learn!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Internet Technology

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report