Close Menu
    DevStackTipsDevStackTips
    • Home
    • News & Updates
      1. Tech & Work
      2. View All

      Sunshine And March Vibes (2025 Wallpapers Edition)

      May 16, 2025

      The Case For Minimal WordPress Setups: A Contrarian View On Theme Frameworks

      May 16, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      May 16, 2025

      How To Prevent WordPress SQL Injection Attacks

      May 16, 2025

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025

      Minecraft licensing robbed us of this controversial NFL schedule release video

      May 16, 2025
    • Development
      1. Algorithms & Data Structures
      2. Artificial Intelligence
      3. Back-End Development
      4. Databases
      5. Front-End Development
      6. Libraries & Frameworks
      7. Machine Learning
      8. Security
      9. Software Engineering
      10. Tools & IDEs
      11. Web Design
      12. Web Development
      13. Web Security
      14. Programming Languages
        • PHP
        • JavaScript
      Featured

      The power of generators

      May 16, 2025
      Recent

      The power of generators

      May 16, 2025

      Simplify Factory Associations with Laravel’s UseFactory Attribute

      May 16, 2025

      This Week in Laravel: React Native, PhpStorm Junie, and more

      May 16, 2025
    • Operating Systems
      1. Windows
      2. Linux
      3. macOS
      Featured

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025
      Recent

      Microsoft has closed its “Experience Center” store in Sydney, Australia — as it ramps up a continued digital growth campaign

      May 16, 2025

      Bing Search APIs to be “decommissioned completely” as Microsoft urges developers to use its Azure agentic AI alternative

      May 16, 2025

      Microsoft might kill the Surface Laptop Studio as production is quietly halted

      May 16, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»Set Data on a Fluent Instance in Laravel 11.36

    Set Data on a Fluent Instance in Laravel 11.36

    December 20, 2024

    Set Data on a Fluent Instance in Laravel 11.36

    This week, the Laravel team released v11.36, which includes a chainable Fluent::set() method, a default global alias for the new Uri class, and more.

    Fluent set() Method

    Steve Bauman contributed a Fluent::set() method, which adds a chainable method that supports dot notation to set deeply nested attributes:

    $fluent = new Fluent;
    
    // Set basic attributes
    $fluent->set('product', 'iPhone')
           ->set('version', 15)
           ->set('developer', 'Apple');
    
    // Use dot notation for nested attributes
    $fluent->set('specs.color', 'Space Black')
           ->set('specs.storage', '256GB')
           ->set('specs.price.usd', 1199);
    
    // Retrieve values
    echo $fluent->product; // "iPhone"
    echo $fluent->specs['color']; // "Space Black"
    echo $fluent->specs['price']['usd']; // 1199
    
    // Retrieve values using get with dot notation
    echo $fluent->get('specs.color'); // "Space Black"
    echo $fluent->get('specs.price.usd'); // 1199
    

    The implementation uses Laravel’s data_set() function, which is a useful helper to work with nested array data:

    $data = ['products' => ['desk' => ['price' => 100]]];
     
    data_set($data, 'products.desk.price', 200);
    data_get($data, 'products.desk.price'); // 200
    

    For further details on setting data on a fluent instance, see Pull Request #53946.

    Uri and UriQueryString implement Stringable

    Luke Kuzmish contributed by adding the Stringable interface to the Uri and UriQueryString classes. These classes already implemented the Stringable interface, which is simply the __toString() magic method:

    use IlluminateSupportUri;
    
    $uri = Uri::of('https://laravel.com')
        ->withQuery(['name' => 'Taylor'])
        ->withPath('/docs/installation')
        ->withFragment('hello-world');
    
    // https://laravel.com/docs/installation?name=Taylor#hello-world
    (string) $uri;
    

    See our post on Laravel v11.35’s URI Parsing and Mutation features to learn more.

    Uri Added as a Default, Global Alias

    Jason McCreary added the new Uri class as a default global alias. That means you can access the Uri class directly without the IlluminateSupport namespace:

    $uri = Uri::of('https://laravel.com')->withQuery(['name' => 'Taylor']);
    

    See Pull Request #53884 for details.

    Release notes

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

    v11.36.0

    • [11.x] Update config/mail.php with supported configuration by @crynobone in https://github.com/laravel/framework/pull/53874
    • [11.x] Allows enum_value() to be use in standalone illuminate/collections by @crynobone in https://github.com/laravel/framework/pull/53871
    • [11.x] Uri and UriQueryString implement Stringable by @cosmastech in https://github.com/laravel/framework/pull/53873
    • [11.x] Prefer new Stringable over Str::of and str() by @lucasmichot in https://github.com/laravel/framework/pull/53883
    • [11.x] No need to redeclare variables by @lucasmichot in https://github.com/laravel/framework/pull/53887
    • [11.x] Add PHP 8.4 with herd to passthrough variables by @lucasmichot in https://github.com/laravel/framework/pull/53885
    • Add new Uri class to default, global aliases by @jasonmccreary in https://github.com/laravel/framework/pull/53884
    • [11.x] Fix attribute mutator access in loadMissing by @SychO9 in https://github.com/laravel/framework/pull/53879
    • [11.x] Fix numericAggregate on eloquent builder by @AmirRezaM75 in https://github.com/laravel/framework/pull/53880
    • [11.x] Prefer new Fluent over fluent() helper by @lucasmichot in https://github.com/laravel/framework/pull/53890
    • Patch by @angelej in https://github.com/laravel/framework/pull/53869
    • [11.x] Collection::wrap by @lucasmichot in https://github.com/laravel/framework/pull/53891
    • [11.x] Bump minimum league/commonmark by @ah-rahimi in https://github.com/laravel/framework/pull/53899
    • [11.x] Collection::range by @lucasmichot in https://github.com/laravel/framework/pull/53895
    • [11.x] Added an event that reports files being deleted when calling the schema:dump --prune command by @andrey-helldar in https://github.com/laravel/framework/pull/53870
    • [11.x] fix: allows injection using multiple interfaces with the same concrete implementation by @jamiethorpe in https://github.com/laravel/framework/pull/53275
    • [11.x] Early return in Factory::modelName() by @shaedrich in https://github.com/laravel/framework/pull/53912
    • [11.x] Prevent blank Helper from Serializing Eloquent Models by @SanderMuller in https://github.com/laravel/framework/pull/53911
    • [11.x] Add word-break to mail links by @seblavoie in https://github.com/laravel/framework/pull/53906
    • Preserve dynamic database connections on reconnect by @nickakitch in https://github.com/laravel/framework/pull/53914
    • Fix mutexName inconsistency caused by different PHP binary paths on multiple servers by @waska14 in https://github.com/laravel/framework/pull/53811
    • [11.x] Add Fluent::set method by @stevebauman in https://github.com/laravel/framework/pull/53946
    • [11.x] Fix inspecting columns of raw indexes by @hafezdivandari in https://github.com/laravel/framework/pull/53945
    • [11.x] Allow easier overriding of the exception thrown by invalid ID in route binding by @cosmastech in https://github.com/laravel/framework/pull/53944
    • [11.x] Fix client path value in file uploads by @gyaaniguy in https://github.com/laravel/framework/pull/53941

    The post Set Data on a Fluent Instance in Laravel 11.36 appeared first on Laravel News.

    Join the Laravel Newsletter to get all the latest
    Laravel articles like this directly in your inbox.

    Source: Read More 

    Facebook Twitter Reddit Email Copy Link
    Previous Articlestepanenko3/laravel-helpers
    Next Article Customizing Data Transformations with Laravel Casts

    Related Posts

    Security

    Nmap 7.96 Launches with Lightning-Fast DNS and 612 Scripts

    May 17, 2025
    Common Vulnerabilities and Exposures (CVEs)

    CVE-2025-40906 – MongoDB BSON Serialization BSON::XS Multiple Vulnerabilities

    May 17, 2025
    Leave A Reply Cancel Reply

    Hostinger

    Continue Reading

    The Role of Affordance in Crafting Design System Components

    Development

    A Web2.5 approach to community building

    Development

    CVE-2025-44863 – TOTOLINK CA300-POE Command Injection Vulnerability

    Common Vulnerabilities and Exposures (CVEs)

    Privacy online – what you can do (and what you can’t)

    Development

    Highlights

    Artificial Intelligence

    Maximising the impact of our breakthroughs

    May 13, 2025

    Colin, CBO at DeepMind, discusses collaborations with Alphabet and how we integrate ethics, accountability, and…

    The Future of Design: Will Skeuomorphism Make a Comeback?

    December 27, 2024

    OpenAI promises GPT-4.5 will “hallucinate less”

    March 16, 2025

    Using Multichannel and Speaker Diarization

    December 7, 2024
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.