What’s New In Laravel 7.12
Hello everyone, I want to say that laravel version 7.12 has been released with a new TrustHosts middleware, along with the latest updates to the 7.x branch. So let’s take a look at what is trusthost middleware.
TrustHosts Middleware
As per the name given TrustHosts it is almost clear that it related to trusted hosts. Which means in the Laravel 7.12 we can configuring a whitelist of trusted hosts in the Illuminate request object.By default, the HTTP Foundation configuration is an empty array, so this middleware will help you lock down the hosts (via regex) your application will recognize.
So you can find App\Http\Middleware\TrustHosts::class
under app/http/kernel.php well in the update currently it is commented you have to remove the comment to use this.
protected $middleware = [
// \App\Http\Middleware\TrustHosts::class,
\App\Http\Middleware\TrustProxies::class,
\Fruitcake\Cors\HandleCors::class,
\App\Http\Middleware\CheckForMaintenanceMode::class,
You can see all changes related to trusthost here https://github.com/laravel/laravel/commit/5639581ea56ecd556cdf6e6edc37ce5795740fd7
Skip Middleware in Resource Routes
Sébastien Nikolaou contributed the ability to skip middleware from resource routes. Here’s an example from Pull Request #32891
Route::middleware(['auth', 'verified'])->group(function () {
Route::resource('photo', 'PhotosController')->withoutMiddleware('verified');
});
Release Notes
You can see full notes of new features and changes and the difference between version  7.11.0 and 7.12.0 on GitHub.
Let’s see what’s added,fixed and changed in the Laravel 7.12
Added
- Added
Illuminate\Http\Middleware\TrustHosts
(9229264) - Ability to skip middleware from resource routes (#32891)
Fixed
- Fixed Queued Mail MessageSent Listener With Attachments (#32795)
- Added error clearing before sending in
Illuminate\Mail\Mailer::sendSwiftMessage()
(#32799) - Avoid foundation function call in the auth component (#32805)
- Fixed inferred table reference for
Illuminate\Database\Schema\ForeignIdColumnDefinition::constrained()
(#32847) - Fixed wrong component generation (73060db)
- Fixed bug with request rebind and url defaults in
Illuminate\Routing\UrlGenerator
(6ad92bf) - Fixed
Illuminate\Cache\ArrayStore::increment()
bug that changes expiration to forever (#32875)
Changed
- Dont cache non objects in
Illuminate/Database/Eloquent/Concerns/HasAttributes::getClassCastableAttributeValue()
(894fe22) - Added explicit
symfony/polyfill-php73
dependency (5796b1e) - Set
Cache\FileStore
file permissions only once (#32845, 11c533b) - Added alias as key of package’s view components (#32863)
Note: You can always see the latest in CHANGELOG-7x
You can also read https://blog.codehunger.in/whats-new-in-laravel-7-0/ which Helps you to know much about Laravel.
I hope you enjoy reading the blog, thank for visiting our website.