In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "what functions have been improved by Laravel 8.77". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn what features Laravel 8.77 has improved.
The Laravel team released version 8.77, which improved the property transformation / accessor, requesting the date () method to access data as an DateTime instance, MAC address validation, the ability to define a custom temporary URL on storage disk, and the latest change branch in v8.x.
Property conversion / accessor improvement
Taylor Otwell provides a new way to define property accessors and modifiers:
/ / before, the two methods public function setTitleAttribute ($value) {$this- > attributes ['title'] = strtolower ($value);} / / the new method protected function title (): Attribute {return new Attribute (set: fn ($value) = > strtolower ($value),);}
Here is an example of an implementation of both get and set:
/ * get the user's title * / protected function title (): Attribute {return new Attribute (get: fn ($value) = > strtoupper ($value), set: fn ($value) = > strtolower ($value),);}
For more information, see the pull request about this feature and the description and discussion about this feature.
Date-time resolution has been added to the request instance
@ Italo provides a date () method for the request instance, which makes it very convenient to get the date instance from the request data:
/ / before if ($date = $request- > input ('when')) {$date = Carbon::parse ($datetime);} / / after $date = $request- > date (' when'); prefix for each connection
Ben Tidy helps to use prefixes on a per-connection basis for Predi. The following is an example of an pull request configured by Redis:
'redis' = > [' client' = > env ('REDIS_CLIENT',' predis'), 'default' = > [' host' = > env ('REDIS_HOST',' 127.0.0.1'), 'password' = > env (' REDIS_PASSWORD', null), 'port' = > env (' REDIS_PORT', 6379), 'database' = > env (' REDIS_DB', 0) 'prefix' = > env (' REDIS_PREFIX', 'prefix:'),],' cache' = > ['host' = > env (' REDIS_HOST', '127.0.0.1'), 'password' = > env (' REDIS_PASSWORD', null), 'port' = > env (' REDIS_PORT', 6379), 'database' = > env (' REDIS_CACHE_DB', 1) 'prefix' = > env (' REDIS_PREFIX', 'prefix2:'),],], MAC address verification rules
Bilal Al-Massry contributes mac_address verification rules to verify MAC addresses:
$trans = $this- > getIlluminateArrayTranslator (); $v = new Validator ($trans, ['mac' = >' foo'], ['mac' = >' mac_address']); $this- > assertFalse ($v-> passes ()); $trans = $this- > getIlluminateArrayTranslator (); $v = new Validator ($trans, ['mac' = >' 01-23-45-67-89 Mobib'], ['mac' = >' mac_address']); $this- > assertTrue ($v-> passes ()); $trans = $this- > getIlluminateArrayTranslator () V = new Validator ($trans, ['mac' = >' 01-23-45-67-89 URL AB'], ['mac' = >' mac_address']); $this- > assertTrue ($v-> passes ()); define temporary URL methods for storage
Ash Allen contributes to the ability to define custom temporary URL logic for Storage facades. Here are several examples of pull requests:
Storage::disk ('local')-> buildTemporaryUrlUsing (function ($path, $expiration, $options) {return' using local';}); / / $url is: 'using local'$url = Storage::temporaryUrl (' file.jpg', now ()-> addMinutes (5)); release Notes
You can see the following complete list of new features and updates and the differences between 8.76.0 and 8.77.0 on github. The following release notes come directly from the change log:
V8.77.0 New
Property conversion / accessor improvement (# 40022)
Add Illuminate/View/Factory::renderUnless () (# 40077)
Add date and time resolution to the Request instance (# 39945)
Enables each connection to use a prefix on Predis (# 40083)
Added rules for validating MAC addresses (# 40098)
Added the ability to define temporary URL for storage (# 40100)
Fixed
Fixed a possible out of memory error in the Redis driver when removing values from the cache by referencing key (# 40039)
Add Illuminate/Filesystem/FilesystemManager::setApplication () (# 40058)
Fixed parameter passing (739d847) in the doesntContain () method
Translate Enum rule messages (# 40089)
Fixed validation of dates (# 40088)
Models and except are not allowed to be used together in PruneCommand.php (f62fe66)
Changed
Use database-specific interpretation commands for Query\ Builder:explain through the Eloquent\ Query::explain method (# 40075)
At this point, I believe you have a deeper understanding of "what features have been improved by Laravel 8.77". You might as well do it in practice. Here is the website, more related content can enter the relevant channels to inquire, follow us, continue 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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.