CoderFunda
  • Home
  • About us
    • Contact Us
    • Disclaimer
    • Privacy Policy
    • About us
  • Home
  • Php
  • HTML
  • CSS
  • JavaScript
    • JavaScript
    • Jquery
    • JqueryUI
    • Stock
  • SQL
  • Vue.Js
  • Python
  • Wordpress
  • C++
    • C++
    • C
  • Laravel
    • Laravel
      • Overview
      • Namespaces
      • Middleware
      • Routing
      • Configuration
      • Application Structure
      • Installation
    • Overview
  • DBMS
    • DBMS
      • PL/SQL
      • SQLite
      • MongoDB
      • Cassandra
      • MySQL
      • Oracle
      • CouchDB
      • Neo4j
      • DB2
      • Quiz
    • Overview
  • Entertainment
    • TV Series Update
    • Movie Review
    • Movie Review
  • More
    • Vue. Js
    • Php Question
    • Php Interview Question
    • Laravel Interview Question
    • SQL Interview Question
    • IAS Interview Question
    • PCS Interview Question
    • Technology
    • Other

12 September, 2024

Laracon US Keynote Framework Updates Are Now In Laravel 11.23

 Programing Coderfunda     September 12, 2024     No comments   

---




The Laravel team released v11.23 this week, with the Laracon US 2024 open-source updates like defer(), concurrency, contextual container attritubes, and more.


Laracon 2024 Updates




Taylor Otwell contributed all of the goodies he shared in his Laracon US 2024 keynote, including chaperone(), defer(), Cache::flexible(), contextual container attributes, and more.


The documentation is being updated; here are a few highlights you should check out to get familiar with these updates:




*
Concurrency Documentation


*
Container Contextual Attributes


*
Automatically Hydrating Parent Models on Children (AKA chaperone())

*
Helpers: Deferred Functions






See Pull Request #52710 for full details on everything added related to Taylor's .


Add minRatio and maxRatio Rules to Dimension Validation




Cam Kemshal-Bell added min and max ratio to the dimensions validation rule:



You can use these methods fluently, using minRatio(), maxRatio(), and ratioBetween():
use Illuminate\Validation\Rule;

//
// Using minRatio and maxRatio fluent methods
//
Rule::dimensions()
->minRatio(1 / 2)
->maxRatio(1 / 3);
// dimensions:min_ratio=0.5,max_ratio=0.33333333333333

//
// Equivalent using ratioBetween()
//
Rule::dimensions()->ratioBetween(min: 1 / 2, max: 1 / 3);

// dimensions:min_ratio=0.5,max_ratio=0.33333333333333



You can also use the string style dimensions rule with this update as well:
use Illuminate\Support\Facades\Validator;

Validator::make($request->all(), [
'min_12' => 'dimensions:min_ratio=1/2',
'square' => 'dimensions:ratio=1',
'max_25' => 'dimensions:max_ratio=2/5',
'min_max' => 'dimensions:min_ratio=1/4,max_ratio=2/5',
]);



Backed Enum Support in Gate Methods and Authorize Middleware




Diaa Fares contributed two pull requests that continue to add backed enum support. This release includes updates to the Gate methods and Authorize middleware.


Here are some examples of using Enums with Gate methods:
enum Abilities: string {
case VIEW_DASHBOARD = 'view-dashboard';
case EDIT = 'edit';
case UPDATE = 'update';
}

// Before
Gate::define('view-dashboard', function (User $user) {
return $user->isAdmin;
});

Gate::authorize('view-dashboard');
Gate::inspect('view-dashboard');
Gate::check('view-dashboard');
Gate::any(['edit', 'update], $post);
Gate::none(['edit', 'update]], $post);
Gate::allows('update', $post);
Gate::denies('update', $post);

// After
Gate::define(Abilities::VIEW_DASHBOARD, function (User $user) {
return $user->isAdmin;
});

Gate::authorize(Abilities::VIEW_DASHBOARD);
Gate::inspect(Abilities::VIEW_DASHBOARD);
Gate::check(Abilities::VIEW_DASHBOARD);
Gate::any([Abilities::EDIT, Abilities::UPDATE], $post);
Gate::none([Abilities::EDIT, Abilities::UPDATE], $post);
Gate::allows(Abilities::UPDATE, $post);
Gate::denies(Abilities::UPDATE, $post);



Here's an example of the Authorize middleware's support for backed enums:
Route::get('/dashboard', [AdminDashboardController::class, 'index'])
->middleware(
Authorize::using(Abilities::VIEW_DASHBOARD)
)
->name(AdminRoutes::DASHBOARD);



Skip Middleware for Queue Jobs




Kennedy Tedesco contributed a Skip middleware to skip a job based on a condition. This middleware has three static constructor methods you can use, including when(), unless(). The job is skipped based on the result of the condition used:
class MyJob implements ShouldQueue
{
use Queueable;

public function handle(): void
{
// TODO
}

public function middleware(): array
{
return [
Skip::when($someCondition), // Skip when `true`

Skip::unless($someCondition), // Skip when `false`

Skip::when(function(): bool {
if ($someCondition) {
return true;
}
return false;
}),
];
}
}



Eloquent Collection findOrFail() Method




Steve Bauman contributed a findOrFail() method on Eloquent collections that adds a way to find a model on an already populated collection:
$users = User::get(); // [User(id: 1), User(id: 2)]

$users->findOrFail(1); // User

$user->findOrFail([]); // []

$user->findOrFail([1, 2]); // [User, User]

$user->findOrFail(3); // ModelNotFoundException: 'No query results for model [User] 3'

$user->findOrFail([1, 2, 3]); // ModelNotFoundException: 'No query results for model [User] 3'



Release notes




You can see the complete list of new features and updates below and the diff between 11.22.0 and 11.23.0 on GitHub. The following release notes are directly from the changelog:


v11.23.0






* [11.x] Fix $fail closure type in docblocks for validation rules by @bastien-phi in
https://github.com/laravel/framework/pull/52644 />

* [11.x] Add MSSQL 2017 and PGSQL 10 builds by @driesvints in
https://github.com/laravel/framework/pull/52631 />

* Update everyThirtyMinutes cron expression by @SamuelNitsche in
https://github.com/laravel/framework/pull/52662 />

* Bump micromatch from 4.0.5 to 4.0.8 in /src/Illuminate/Foundation/resources/exceptions/renderer by @dependabot in
https://github.com/laravel/framework/pull/52664 />

* [11.x] apply excludeUnvalidatedArrayKeys to list validation by @lorenzolosa in
https://github.com/laravel/framework/pull/52658 />

* [11.x] Adding minRatio & maxRatio rules on Dimension validation ruleset by @CamKem in
https://github.com/laravel/framework/pull/52482 />

* [11.x] Add BackedEnum support to Authorize middleware by @diaafares in
https://github.com/laravel/framework/pull/52679 />

* [11.x] Add BackedEnum support to Gate methods by @diaafares in
https://github.com/laravel/framework/pull/52677 />

* [11.x] Suggest serializable-closure by @driesvints in
https://github.com/laravel/framework/pull/52673 />

* [11.x] Fix alter table expressions on SQLite by @hafezdivandari in
https://github.com/laravel/framework/pull/52678 />

* [11.x] Add Exceptions\Handler::mapLogLevel(...) so the logic can be easily overridden by @taka-oyama in
https://github.com/laravel/framework/pull/52666 />

* [11.x] Bugfix for calling pluck() on chaperoned relations. by @samlev in
https://github.com/laravel/framework/pull/52680 />

* [11.x] Fix build failures due to enum collide After adding BackedEnum support to Gate by @diaafares in
https://github.com/laravel/framework/pull/52683 />

* Fixing Str::trim to remove the default trim/ltrim/rtim characters " \n\r\t\v\0" by @mathiasgrimm in
https://github.com/laravel/framework/pull/52684 />

* [11.x] Add Skip middleware for Queue Jobs by @KennedyTedesco in
https://github.com/laravel/framework/pull/52645 />

* [11.x] Fix etag headers for binary file responses by @wouterrutgers in
https://github.com/laravel/framework/pull/52705 />

* [11.x] add withoutDelay() to PendingDispatch by @KennedyTedesco in
https://github.com/laravel/framework/pull/52696 />

* [11.x] Refactor Container::getInstance() to use null coalescing assignment by @xurshudyan in
https://github.com/laravel/framework/pull/52693 />

* [11.x] Removed unnecessary call to setAccessible(true) by @xurshudyan in
https://github.com/laravel/framework/pull/52691 />

* [11.x] Add Eloquent\Collection::findOrFail by @stevebauman in
https://github.com/laravel/framework/pull/52690 />

* [11.x] PHPStan Improvements by @crynobone in
https://github.com/laravel/framework/pull/52712 />

* [11.x] Fix Collection PHPDoc by @staudenmeir in
https://github.com/laravel/framework/pull/52724 />

* [11.x] Add optional parameter for confirmed validator rule by @jwpage in
https://github.com/laravel/framework/pull/52722 />

* [11.x] Test Improvements by @crynobone in
https://github.com/laravel/framework/pull/52718 />

* [11.x] Fix incorrect variable-length argument $guards from array to string by @kayw-geek in
https://github.com/laravel/framework/pull/52719 />

* Allow testing of relative signed routes by @shealavington in
https://github.com/laravel/framework/pull/52726 />

* [11.x] fix: Builder::with closure types by @calebdw in
https://github.com/laravel/framework/pull/52729 />

* Laracon 2024 by @taylorotwell in
https://github.com/laravel/framework/pull/52710 />

* Add Tag attribute by @TijmenWierenga in
https://github.com/laravel/framework/pull/52743 />

* [11.x] Adds BackedEnum to PendingDispatch's phpDoc for onQueue, allOnQueue, onConnection, allOnConnection methods by @sethsandaru in
https://github.com/laravel/framework/pull/52739 />

* New when() helper. by @danmatthews in
https://github.com/laravel/framework/pull/52665 />

* [11.x] Add fromUrl() to Attachment by @KennedyTedesco in
https://github.com/laravel/framework/pull/52688 />






The post Laracon US Keynote Framework Updates Are Now In Laravel 11.23 appeared first on Laravel News.


Join the Laravel Newsletter to get Laravel articles like this directly in your inbox.
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
  •  Stumble
  •  Digg
Email ThisBlogThis!Share to XShare to Facebook
Newer Post Older Post Home

0 comments:

Post a Comment

Thanks

Meta

Popular Posts

  • Sitaare Zameen Par Full Movie Review
     Here’s a  complete Vue.js tutorial for beginners to master level , structured in a progressive and simple way. It covers all essential topi...
  • AI foot tracking model
    I am a student doing a graduation project. I urgently need to deal with this model (I am attaching a link). I've never worked with pytho...
  • Credit card validation in laravel
      Validation rules for credit card using laravel-validation-rules/credit-card package in laravel Install package laravel-validation-rules/cr...
  • Laravel - Installation
    For managing dependencies, Laravel uses   composer . Make sure you have a Composer installed on your system before you install Laravel. In t...
  • Prithviraj (2022) DVDScr Hindi Movie Watch Online Free
      Prithviraj Hindi  Torrent  Download  DVDScr  Quality Prithviraj Movie Info: Directed by:   Chandra Prakash Dwivedi Starring by:   Akshay K...

Categories

  • Ajax (26)
  • Bootstrap (30)
  • DBMS (42)
  • HTML (12)
  • HTML5 (45)
  • JavaScript (10)
  • Jquery (34)
  • Jquery UI (2)
  • JqueryUI (32)
  • Laravel (1017)
  • Laravel Tutorials (23)
  • Laravel-Question (6)
  • Magento (9)
  • Magento 2 (95)
  • MariaDB (1)
  • MySql Tutorial (2)
  • PHP-Interview-Questions (3)
  • Php Question (13)
  • Python (36)
  • RDBMS (13)
  • SQL Tutorial (79)
  • Vue.js Tutorial (69)
  • Wordpress (150)
  • Wordpress Theme (3)
  • codeigniter (108)
  • oops (4)
  • php (853)

Social Media Links

  • Follow on Twitter
  • Like on Facebook
  • Subscribe on Youtube
  • Follow on Instagram

Pages

  • Home
  • Contact Us
  • Privacy Policy
  • About us

Blog Archive

  • July (4)
  • September (100)
  • August (50)
  • July (56)
  • June (46)
  • May (59)
  • April (50)
  • March (60)
  • February (42)
  • January (53)
  • December (58)
  • November (61)
  • October (39)
  • September (36)
  • August (36)
  • July (34)
  • June (34)
  • May (36)
  • April (29)
  • March (82)
  • February (1)
  • January (8)
  • December (14)
  • November (41)
  • October (13)
  • September (5)
  • August (48)
  • July (9)
  • June (6)
  • May (119)
  • April (259)
  • March (122)
  • February (368)
  • January (33)
  • October (2)
  • July (11)
  • June (29)
  • May (25)
  • April (168)
  • March (93)
  • February (60)
  • January (28)
  • December (195)
  • November (24)
  • October (40)
  • September (55)
  • August (6)
  • July (48)
  • May (2)
  • January (2)
  • July (6)
  • June (6)
  • February (17)
  • January (69)
  • December (122)
  • November (56)
  • October (92)
  • September (76)
  • August (6)

Loading...

Laravel News

Loading...

Copyright © CoderFunda | Powered by Blogger
Design by Coderfunda | Blogger Theme by Coderfunda | Distributed By Coderfunda