Eloquent tricks

By @lars · 2021-08-30 13:48

Eloquent tricks

  • By @ralphjsmit · 2021-08-31 09:03

    Hey Lars, great tips! I like especially the first one. One question, what info is available in a model that’s not (yet) hydrated? The id? And are those models hydrated the moment you use them?

    And third, in what situations would this be really recommended? I’ve a little difficulty coming up with good use cases for this :)

    • By @lars · 2021-08-31 19:08

      To answer your first question, you'll just receive the columns that you query from the DB. To answer your second question, counting multiple columns, like todos which can have multiple statuses