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

      Sunshine And March Vibes (2025 Wallpapers Edition)

      June 3, 2025

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

      June 3, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      June 3, 2025

      How To Prevent WordPress SQL Injection Attacks

      June 3, 2025

      SteelSeries reveals new Arctis Nova 3 Wireless headset series for Xbox, PlayStation, Nintendo Switch, and PC

      June 3, 2025

      The Witcher 4 looks absolutely amazing in UE5 technical presentation at State of Unreal 2025

      June 3, 2025

      Razer’s having another go at making it so you never have to charge your wireless gaming mouse, and this time it might have nailed it

      June 3, 2025

      Alienware’s rumored laptop could be the first to feature NVIDIA’s revolutionary Arm-based APU

      June 3, 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

      easy-live2d – About Make your Live2D as easy to control as a pixi sprite! Live2D Web SDK based on Pixi.js.

      June 3, 2025
      Recent

      easy-live2d – About Make your Live2D as easy to control as a pixi sprite! Live2D Web SDK based on Pixi.js.

      June 3, 2025

      From Kitchen To Conversion

      June 3, 2025

      Perficient Included in Forrester’s AI Technical Services Landscape, Q2 2025

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

      SteelSeries reveals new Arctis Nova 3 Wireless headset series for Xbox, PlayStation, Nintendo Switch, and PC

      June 3, 2025
      Recent

      SteelSeries reveals new Arctis Nova 3 Wireless headset series for Xbox, PlayStation, Nintendo Switch, and PC

      June 3, 2025

      The Witcher 4 looks absolutely amazing in UE5 technical presentation at State of Unreal 2025

      June 3, 2025

      Razer’s having another go at making it so you never have to charge your wireless gaming mouse, and this time it might have nailed it

      June 3, 2025
    • Learning Resources
      • Books
      • Cheatsheets
      • Tutorials & Guides
    Home»Development»New Eloquent Relation Existence Methods in Laravel 11.37

    New Eloquent Relation Existence Methods in Laravel 11.37

    January 7, 2025

    New Eloquent Relation Existence Methods in Laravel 11.37

    Last week the Laravel team released v11.37, which includes new Eloquent relation methods, an option to ignore case with Str::is(), adding the Dumpable trait to a Uri instance, and more.

    Add Dumpable Trait to Uri

    Adrian Nürnberger added the Dumpable trait to the Uri class, which allows you to call dump() and dd() on a Uri instance. This allows you to dump at a certain point in the chain of your Uri instance, or dump and exit using dd():

    Add “Ignore Case” Option to Str::is()

    Steve Bauman contributed the ability to ignore case using the Str::is() method as well as a Stringable instance. This allows developers to remove strict-case comparison, similar to how Str::contains() works:

    New Eloquent Relation Methods

    Andrey Helldar contributed whereDoesntHaveRelation and whereDoesntHaveMorph relation method, which are the opposite of the existing relation existence queries.

    whereDoesntHaveRelation examples:

    // Before
    User::whereDoesntHave('comments', function ($query) {
        $query->where('created_at', '>', now()->subDay());
    })->get();
    
    // After
    User::whereDoesntHaveRelation(
        'comments', 'created_at', '>', now()->subDay()
    )->get();
    
    // Another example
    User::whereDoesntHaveRelation(
        'comments', 'is_approved', false
    )->get();
    

    whereMorphDoesntHaveRelation examples:

    // Before
    User::whereDoesntHaveMorph('comments', [Post::class, Video::class], function ($query) {
        $query->where('created_at', '>', now()->subDay());
    })->get();
    
    // After
    User::whereMorphDoesntHaveRelation(
        'comments', [Post::class, Video::class], 'created_at', '>', now()->subDay()
    )->get();
    
    User::whereMorphDoesntHaveRelation(
        'comments', [Post::class, Video::class], 'is_approved', false
    )->get();
    

    Add assertFailedWith to InteractsWithQueue Trait

    Teddy Francfort contributed an assertFailedWith method to the InteractsWithQueue trait, which allows you to check a failure exception in a test:

    use AppJobsProcessPodcast;
    use AppExceptionsMyException;
     
    $job = new ProcessPodcast()->withFakeQueueInteractions();
    
    $job->assertFailedWith('whoops');
    $job->assertFailedWith(MyException::class);
    $job->assertFailedWith(new MyException);
    $job->assertFailedWith(new MyException(message: 'whoops'));
    $job->assertFailedWith(new MyException(message: 'whoops', code: 123));
    

    Release notes

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

    v11.37.0

    • [11.x] Update Collection::hasAny by @JeftaAtSiip in https://github.com/laravel/framework/pull/53963
    • [11.x] Update DetectsLostConnections trait by @holgerk in https://github.com/laravel/framework/pull/53966
    • Fix: (Queue Worker) firing the JobPopped event when $popCallbacks returns null by @rudenav in https://github.com/laravel/framework/pull/53962
    • [11.x] Add Dumpable trait to Uri by @nuernbergerA in https://github.com/laravel/framework/pull/53960
    • Fix: Handle mixed-type values in compileInsert by @alipadron in https://github.com/laravel/framework/pull/53948
    • [11.x] Add $ignoreCase option to Str::is by @stevebauman in https://github.com/laravel/framework/pull/53981
    • [11.x] Updates component dependencies by @crynobone in https://github.com/laravel/framework/pull/53975
    • [11.x] Update Uri withoutQuery method to accept string or array input by @1weiho in https://github.com/laravel/framework/pull/53973
    • [11.x] Fix cached health endpoint not working when in maintenance mode by @crynobone in https://github.com/laravel/framework/pull/53974
    • Add PHPDoc type hints by @shaedrich in https://github.com/laravel/framework/pull/53984
    • [11.x] Allow passing bool to facade Http@preventStrayRequests() by @cosmastech in https://github.com/laravel/framework/pull/53992
    • [11.x] Use Str::wrap() instead of nesting Str::start() inside Str::finish() by @shaedrich in https://github.com/laravel/framework/pull/53987
    • Fix day range in docblock by @timacdonald in https://github.com/laravel/framework/pull/53985
    • [11.x] Fixes IlluminateHttpResponse to output empty string if $content is set to null by @crynobone in https://github.com/laravel/framework/pull/53872
    • [11.x] Fix/Improve Resend transport response handling by @markovic-nikola in https://github.com/laravel/framework/pull/54004
    • [11.x] Update View::withErrors() docblock to reflect string parameter support by @cheack in https://github.com/laravel/framework/pull/54009
    • 11.x improve resend transport response handling – fix by @markovic-nikola in https://github.com/laravel/framework/pull/54006
    • [11.x] Added new Eloquent methods: whereDoesntHaveRelation, whereMorphDoesntHaveRelation and their variants with OR by @andrey-helldar in https://github.com/laravel/framework/pull/53996
    • [11.x] Re-refresh the database if the RefreshDatabase transaction was committed by @SjorsO in https://github.com/laravel/framework/pull/53997
    • [11.x] add assertFailedWith to InteractsWithQueue trait by @teddy-francfort in https://github.com/laravel/framework/pull/53980
    • Quick doc fix by @mathiasgrimm in https://github.com/laravel/framework/pull/54040
    • [11.x] Allow using IlluminateSupportUri on testing HTTP Requests by @crynobone in https://github.com/laravel/framework/pull/54038
    • [11.x] Adding tests for Overlapping Routes by @mathiasgrimm in https://github.com/laravel/framework/pull/54050
    • [11.x] adding tests for null & * key given in data_get by @jwjenkin in https://github.com/laravel/framework/pull/54059

    The post New Eloquent Relation Existence Methods in Laravel 11.37 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 ArticleOptimizing Large Data Delivery with Laravel Streaming Responses
    Next Article No Windows 12 for now: Microsoft to focus on Windows 11 and Copilot+ PCs

    Related Posts

    Security

    Alert: Malicious RubyGems Impersonate Fastlane Plugins, Steal CI/CD Data

    June 3, 2025
    Security

    Critical CVSS 9.6: IBM QRadar & Cloud Pak Security Flaws Exposed

    June 3, 2025
    Leave A Reply Cancel Reply

    Continue Reading

    World-Consistent Video Diffusion With Explicit 3D Modeling

    Machine Learning

    Calender.js v2.12.0 – View disabling, and lots of new settings and fixes!

    Development

    Exploring the Nokia Design Archive: A Journey Through Mobile Innovation

    Web Development

    CVE-2025-3884 – Cloudera Hue Ace Editor Directory Traversal Information Disclosure

    Common Vulnerabilities and Exposures (CVEs)

    Highlights

    Development

    Evaluation Agent: A Multi-Agent AI Framework for Efficient, Dynamic, Multi-Round Evaluation, While Offering Detailed, User-Tailored Analyses

    December 23, 2024

    Visual generative models have advanced significantly in terms of the ability to create high-quality images…

    marcreichel/igdb-laravel

    January 12, 2025

    CVE-2025-5360 – Campcodes Online Hospital Management System SQL Injection Vulnerability

    May 30, 2025

    The best small-business CRM software of 2025: Expert tested

    March 21, 2025
    © DevStackTips 2025. All rights reserved.
    • Contact
    • Privacy Policy

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