fideloper / Implementing-Laravel

Companion application to the e-book Implementing Laravel
173 stars 40 forks source link

Wrong variable returned #3

Closed HellPat closed 11 years ago

HellPat commented 11 years ago

Page 36 in PDF prepares the statement for a paginated result but instead it returns $articles->all(); in the StdClass.

Seems to be wrong?!

fideloper commented 11 years ago

I believe that was on purpose - saving an array of Eloquent objects instead of the Collection object. However, I'll check it out! I'm going to be reviewing feedback this weekend.

Thank!

HellPat commented 11 years ago

Oh sorry... by bad: Page 37 L 93 is the one that seems wrong to me. $ Symbol missing, too.

fideloper commented 11 years ago

Thanks!

I fixed the missing $. However, setting the items to $articles->all() is on purpose - I with to save the array of Eloquent models, rather than the pagination item itself. This is both because I don't want Laravel's Pagination object to be an implicit dependency of the repository and because (later as seen in the cacheing chapter), there are issues with cacheing the Pagination object as it contains a Closure.

Thanks again for your help improving the book!