The Laravel team released v12.14.0, which includes a new Arr::from()
method, a currentlyResolving()
container method, new "except" Context methods, and more:
Arr::from() Method
Sergey Danilchenko contributed an Arr::from()
method to get the underlying array of items from the given argument:
use Illuminate\Support\Arr; Arr::from(collect(['name' => 'Laravel'])); // ['name' => 'Laravel']Arr::from($jsonable); // Decodes the object data via `Jsonable` as an arrayArr::from($arrayable); // Returns array via the object `toArray()` method
See Pull Request #55715 for details.
New Context Methods
Volodya Kurshudyan contributed except()
and exceptHidden()
methods to the Context
class to retrieve all values except the specified keys:
Context::add('user_id', 42);Context::add('request_id', 'req-abc123');Context::add('ip_address', '192.168.0.1');Context::add('sensitive_token', 'secret'); $logData = Context::except(['sensitive_token']); // Result:[ 'user_id' => 42, 'request_id' => 'req-abc123', 'ip_address' => '192.168.0.1',]
See Pull Request #55692 for details.
currentlyResolving
utility method
Container Justin Seliga contributed a currentlyResolving
that returns the binding that the container is currently resolving:
#[Attribute(Attribute::TARGET_PARAMETER)]class RegisteredFor implements ContextualAttribute{ public static function resolve(self $attribute, Container $container): array { $resolving = $container->currentlyResolving(); // Production::class return resolve(Registrar::class)->for($resolving); }}
See Pull Request #55684 for details.
Release notes
You can see the complete list of new features and updates below and the diff between 12.13.0 and 12.14.0 on GitHub. The following release notes are directly from the changelog:
v12.14.0
- [12.x] Support
useCurrent
on date and year column types by @nicholasbrantley in https://github.com/laravel/framework/pull/55619 - [12.x] Update "Number::fileSize" to use correct prefix and add prefix param by @Boy132 in https://github.com/laravel/framework/pull/55678
- [12.x] Update PHPDoc for whereRaw to allow Expression as $sql by @mitoop in https://github.com/laravel/framework/pull/55674
- Revert "[12.x] Make Blueprint Resolver Statically" by @taylorotwell in https://github.com/laravel/framework/pull/55690
- [12.x] Support Virtual Properties When Serializing Models by @beschoenen in https://github.com/laravel/framework/pull/55691
- [12.X] Fix
Http::preventStrayRequests
error propagation when usingHttp::pool
by @LeTamanoir in https://github.com/laravel/framework/pull/55689 - [12.x] incorrect use of generics in Schema\Builder by @taka-oyama in https://github.com/laravel/framework/pull/55687
- [12.x] Add option to disable MySQL ssl when restoring or squashing migrations by @andersonls in https://github.com/laravel/framework/pull/55683
- [12.x] Add
except
andexceptHidden
methods toContext
class by @xurshudyan in https://github.com/laravel/framework/pull/55692 - [12.x] Container
currentlyResolving
utility by @jrseliga in https://github.com/laravel/framework/pull/55684 - [12.x] Container
currentlyResolving
test by @jrseliga in https://github.com/laravel/framework/pull/55694 - [12.x] Fix handling of default values for route parameters with a binding field by @stancl in https://github.com/laravel/framework/pull/55697
- Move Timebox for Authentication and add to password resets by @valorin in https://github.com/laravel/framework/pull/55701
- [12.x] perf: Optimize BladeCompiler by @rzv-me in https://github.com/laravel/framework/pull/55703
- [12.x] perf: support iterables for event discovery paths by @calebdw in https://github.com/laravel/framework/pull/55699
- [12.x] Types: AuthorizesRequests::resourceAbilityMap by @liamduckett in https://github.com/laravel/framework/pull/55706
- [12.x] Add flexible support to memoized cache store by @timacdonald in https://github.com/laravel/framework/pull/55709
- [12.x] Introduce Arr::from() by @daniser in https://github.com/laravel/framework/pull/55715
- [12.x] Fix the
getCurrentlyAttachedPivots
wrongmorphClass
for morph to many relationships by @amir9480 in https://github.com/laravel/framework/pull/55721 - [12.x] Improve typehints for Http classes by @cosmastech in https://github.com/laravel/framework/pull/54783
- Add deleteWhen for throttle exceptions job middleware by @moshe-autoleadstar in https://github.com/laravel/framework/pull/55718