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

      Sunshine And March Vibes (2025 Wallpapers Edition)

      June 1, 2025

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

      June 1, 2025

      How To Fix Largest Contentful Paint Issues With Subpart Analysis

      June 1, 2025

      How To Prevent WordPress SQL Injection Attacks

      June 1, 2025

      My top 5 must-play PC games for the second half of 2025 — Will they live up to the hype?

      June 1, 2025

      A week of hell with my Windows 11 PC really makes me appreciate the simplicity of Google’s Chromebook laptops

      June 1, 2025

      Elden Ring Nightreign Night Aspect: How to beat Heolstor the Nightlord, the final boss

      June 1, 2025

      New Xbox games launching this week, from June 2 through June 8 — Zenless Zone Zero finally comes to Xbox

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

      Student Record Android App using SQLite

      June 1, 2025
      Recent

      Student Record Android App using SQLite

      June 1, 2025

      When Array uses less memory than Uint8Array (in V8)

      June 1, 2025

      Laravel 12 Starter Kits: Definite Guide Which to Choose

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

      My top 5 must-play PC games for the second half of 2025 — Will they live up to the hype?

      June 1, 2025
      Recent

      My top 5 must-play PC games for the second half of 2025 — Will they live up to the hype?

      June 1, 2025

      A week of hell with my Windows 11 PC really makes me appreciate the simplicity of Google’s Chromebook laptops

      June 1, 2025

      Elden Ring Nightreign Night Aspect: How to beat Heolstor the Nightlord, the final boss

      June 1, 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:

    Hostinger
    // 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

    New Linux Flaws Allow Password Hash Theft via Core Dumps in Ubuntu, RHEL, Fedora

    June 2, 2025
    Security

    Google AI Edge Gallery: Unleash On-Device AI Power on Your Android (and Soon iOS!)

    June 2, 2025
    Leave A Reply Cancel Reply

    Hostinger

    Continue Reading

    Chrome Vulnerability Alert: Google’s Rapid Response to 6th Zero-Day Exploit

    Development

    The Future of Technology in the Finance Field: A New Era of Innovation

    Artificial Intelligence

    Use Zoom In and Out While Recording in OBS Studio

    Development

    madison.clark@salesfacilitation.com

    Development
    GetResponse

    Highlights

    Development

    Unlocking the Recall Power of Large Language Models: Insights from Needle-in-a-Haystack Testing

    April 19, 2024

    The rise of Large Language Models (LLMs) has revolutionized Natural Language Processing (NLP), enabling significant…

    ChatGPT Now Recommends Products and Prices With New Shopping Features

    April 29, 2025

    The Curse of the Dirty Hag Woman

    January 17, 2025

    Quantum Computing Secrets They Don’t Want You to Know!

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

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