search
HomePHP FrameworkLaravelLaravel 9.47 is released! Update at a glance~

This article brings you the latest news about Laravel9.47, which mainly introduces the new features of the 9.47 version recently released by the Laravel team. Friends who are interested should take a look at it. I hope it will be helpful to everyone. help.

Laravel 9.47 is released! Update at a glance~

The Laravel team recently released 9.47, which includes new Eloquent collection visibility methods, "destructible" singleton routing, and support for lazy loading collections with batch fake Etc.:

New Eloquent collection visibility methods

Jess Archer contributed setVisible and # to Eloquent collections ##setHidden method. The setVisible method is useful when you want to be explicit about the data you want to return, and it won't leak when adding new properties to the model:

$users->setVisible(['id', 'name'])->toArray();
/*
[
    [
        'id' => 1,
        'name' => 'Test User',
    ]
]
*/
If you only have a few to explicitly hide field, but usually want the default value to be visible, the opposite setHidden is useful.

Support for lazy loading of collections in BatchFake

Evan Burrell Contributed when using withFakeBatch() with jobs Added support for LazyCollection. Thanks to this feature, the following features are now available:

use Batchable;

Model::cursor()
    ->map(fn (Model $model) => new ModelJob($model))
    ->chunk(1000)
    ->each(function (LazyCollection $jobs) {
        $this->batch->add($jobs);
    });

// 相关测试
[$job] = (new ModelJobBatch())->withFakeBatch();

$job->handle();
To learn more about simulating batches, click

Test Simulator.

" available Destroyed "singleton routing

Choraimy Kroonstuiver contributed a simple method to mark singleton routing as "destructible". Routes of this type can be deleted, but are not created by default.

// 以前
Route::singleton(...)->creatable()->except('create', 'store');

// 之后
Route::singleton(...)->destroyable();
Release Notes

You can see the full list of new features and updates below on GitHub as well as the differences between

9.46.0 and 9.47.0. The following release notes are taken directly from changelog:

v9.47.0

New

    in
  • BatchFake::add() Added support for lazy loading collections (#45507)
  • Add decimals to the number rule list (
  • #45533)
  • Add
  • Illuminate/Routing/PendingSingletonResourceRegistration::destroyable() Destructible routing (#45549)
  • Add setVisible and setHidden to the Eloquent collection (
  • #45558)
Fix

    Fix binding method context binding (
  • #45500)
  • Fix method
  • explodeExplicitRule Fix with regular expression rules (#45555)
  • Illuminate/Database/Query/Builder::whereIntegerInRaw() Method (#45584 )
  • Fix template tag (
  • #45490)
Modify

    Return model when converting attributes
  • (
    #45539)
  • Always display the complete migration path
  • Illuminate/Database/Console/Migrations/MigrateMakeCommand.php (9f6ff48)
  • Delete the index name when adding a primary key on MySQL (
  • #45515)
Recommended learning: "
laravel video tutorial"

Original address:

https://www.php.cn/link/67163b84d38995c8661d9f8a5b1f8d46

Translation address: https://www.php.cn/link/10af1041993950de8d8775280b66277a

The above is the detailed content of Laravel 9.47 is released! Update at a glance~. For more information, please follow other related articles on the PHP Chinese website!

Statement
This article is reproduced at:learnku. If there is any infringement, please contact admin@php.cn delete
What is the latest Laravel version?What is the latest Laravel version?May 09, 2025 am 12:09 AM

As of October 2023, Laravel's latest version is 10.x. 1.Laravel10.x supports PHP8.1, improving development efficiency. 2.Jetstream improves support for Livewire and Inertia.js, simplifies front-end development. 3.EloquentORM adds full-text search function to improve data processing performance. 4. Pay attention to dependency package compatibility when using it and apply cache optimization performance.

Laravel Migrations: A Beginner's Guide to Database ManagementLaravel Migrations: A Beginner's Guide to Database ManagementMay 09, 2025 am 12:07 AM

LaravelMigrationsstreamlinedatabasemanagementbyprovidingversioncontrolforyourdatabaseschema.1)Theyallowyoutodefineandsharethestructureofyourdatabase,makingiteasytomanagechangesovertime.2)Migrationscanbecreatedandrunusingsimplecommands,ensuringthateve

Laravel migration: Best coding guideLaravel migration: Best coding guideMay 09, 2025 am 12:03 AM

Laravel's migration system is a powerful tool for developers to design and manage databases. 1) Ensure that the migration file is named clearly and use verbs to describe the operation. 2) Consider data integrity and performance, such as adding unique constraints to fields. 3) Use transaction processing to ensure database consistency. 4) Create an index at the end of the migration to optimize performance. 5) Maintain the atomicity of migration, and each file contains only one logical operation. Through these practices, efficient and maintainable migration code can be written.

Latest Laravel Version: Stay Up-to-Date with the Newest FeaturesLatest Laravel Version: Stay Up-to-Date with the Newest FeaturesMay 09, 2025 am 12:03 AM

Laravel's latest version is 10.x, released in early 2023. This version brings enhanced EloquentORM functionality and a simplified routing system, improving development efficiency and performance, but it needs to be tested carefully during upgrades to prevent problems.

Mastering Laravel Soft Deletes: Best Practices and Advanced TechniquesMastering Laravel Soft Deletes: Best Practices and Advanced TechniquesMay 08, 2025 am 12:25 AM

Laravelsoftdeletesallow"deletion"withoutremovingrecordsfromthedatabase.Toimplement:1)UsetheSoftDeletestraitinyourmodel.2)UsewithTrashed()toincludesoft-deletedrecordsinqueries.3)CreatecustomscopeslikeonlyTrashed()forstreamlinedcode.4)Impleme

Laravel Soft Deletes: Restoring and Permanently Deleting RecordsLaravel Soft Deletes: Restoring and Permanently Deleting RecordsMay 08, 2025 am 12:24 AM

In Laravel, restore the soft deleted records using the restore() method, and permanently delete the forceDelete() method. 1) Use withTrashed()->find()->restore() to restore a single record, and use onlyTrashed()->restore() to restore a single record. 2) Permanently delete a single record using withTrashed()->find()->forceDelete(), and multiple records use onlyTrashed()->forceDelete().

The Current Laravel Release: Download and Upgrade Today!The Current Laravel Release: Download and Upgrade Today!May 08, 2025 am 12:22 AM

You should download and upgrade to the latest Laravel version as it provides enhanced EloquentORM capabilities and new routing features, which can improve application efficiency and security. To upgrade, follow these steps: 1. Back up the current application, 2. Update the composer.json file to the latest version, 3. Run the update command. While some common problems may be encountered, such as discarded functions and package compatibility, these issues can be solved through reference documentation and community support.

Laravel: When should I update to the last version?Laravel: When should I update to the last version?May 08, 2025 am 12:18 AM

YoushouldupdatetothelatestLaravelversionwhenthebenefitsclearlyoutweighthecosts.1)Newfeaturesandimprovementscanenhanceyourapplication.2)Securityupdatesarecrucialifvulnerabilitiesareaddressed.3)Performancegainsmayjustifyanupdateifyourappstruggles.4)Ens

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

mPDF

mPDF

mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

MantisBT

MantisBT

Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software