Eloquent's New Chaperone Method

Поділитися
Вставка
  • Опубліковано 5 січ 2025

КОМЕНТАРІ •

  • @jonathanjohnson2785
    @jonathanjohnson2785 3 місяці тому

    Jeffrey really has a knack for educating complete beginners like me😅. Bravo🎉

  • @fakerealnews1
    @fakerealnews1 3 місяці тому +3

    Love your videos, here and at laracast.

  • @brunoggdev6305
    @brunoggdev6305 3 місяці тому +1

    That outro was awesome, loved it

  • @erickdeazevedolima1763
    @erickdeazevedolima1763 3 місяці тому

    I updated to 11.22 because it happened to be the feature I was needing at the moment. It's not that we don't know how to do it manually. The point is that it's easy to forget to do it and end up with the n+1 query problem. It's just handy. And about the naming: I think that "goAlong" would be nice too: $this->hasMany(Video::class)->goAlong()->orderBy('position');

  • @im-nazmul
    @im-nazmul 3 місяці тому +5

    Are you planning to discuss all the new features that were announced at the recent Laracon? That's much needed now.

  • @itisconsulting
    @itisconsulting 3 місяці тому

    Best Teacher ever!

  • @eyemazed
    @eyemazed 3 місяці тому +6

    Hmm I would probably just pass the $series model to the map callback function with use($series)

    • @bojackhorsemanners
      @bojackhorsemanners 3 місяці тому +1

      First thing I thought about too.

    • @jeffreyway520
      @jeffreyway520 3 місяці тому +1

      It’s a silly example. The point is you will often not have immediate access to the parent series model.

  • @tahashaban-du6fi
    @tahashaban-du6fi 3 місяці тому

    very helpful thank you 🙌

  • @deen812x
    @deen812x 18 днів тому

    oh, so interesting method)

  • @AMoktar
    @AMoktar 3 місяці тому

    Thanks ❤

  • @tariksadiku4723
    @tariksadiku4723 3 місяці тому +18

    Can't we just return $series->title immediately inside the map function?

    • @SXsoft99
      @SXsoft99 3 місяці тому +2

      you can, the examples sometimes that they show are not completely clear on the use cases

    • @ricardoruiz3986
      @ricardoruiz3986 3 місяці тому +2

      That's what I was thinking. I guess chaperone might be useful if you're a senior dev trying to prevent a junior from making the mistake though.

    • @ParisBenjaminsound
      @ParisBenjaminsound 3 місяці тому

      I think we were trying to avoid n+1

  • @grise123
    @grise123 3 місяці тому

    jeffrey, yes we need to know the internals please

  • @Md.NajmulHasan-xo9qh
    @Md.NajmulHasan-xo9qh 3 місяці тому

    That's amazing

  • @SXsoft99
    @SXsoft99 3 місяці тому

    so let me get it strait, from what i see chaperone remove one extra loop meaning it's setting the relation object on episodes collection instantiation instead of creating the collection and then looping it and setting the rel.

  • @cuts_pro_trick
    @cuts_pro_trick 3 місяці тому

    What's the theme phostrome jeff?

  • @DeTechDivus
    @DeTechDivus 3 місяці тому +1

    Is defer also available?

  • @RockstahRolln
    @RockstahRolln 3 місяці тому

    Thank You ❤

  • @jasonennis4905
    @jasonennis4905 Місяць тому

    Wouldn’t the $with property on the model do this ?

  • @draiczon
    @draiczon 3 місяці тому

    Quick question, is chaperone() available only for hasMany relationships or can we use it for belongsToMany(), if we can't, anyone knows why?

  • @RodrigoMendoza7
    @RodrigoMendoza7 3 місяці тому

    Besides applying it to the episodes, do we need to apply it to the inverse relation (series)?

  • @nielskok2935
    @nielskok2935 2 місяці тому

    Why wouldn't you want to have this on all the time? What is the disadvantage?

  • @pratikbhujel
    @pratikbhujel 3 місяці тому

    What's the music in intro wanna make that my ringtone so catchy.

  • @jalex2862
    @jalex2862 3 місяці тому

    Are you using vim motions?

  • @borakayalar
    @borakayalar 3 місяці тому

    Can I use it on Larave 10.x ?