Support the ongoing development of →
posted 8 years ago
Last updated 1 year ago.

Makes perfect sense.

Welcome of the 'using active record with repository pattern' contradiction.

Ideally, in a perfect world, you would return orm-agnostic php object from your repositories, having relationships as collections, etc... Which, let's face it, is a lot to implement.

So all its down to having a perfect architecture vs having something done quickly (and which work the same :) ) , it's almost always a tradeoff.

Eloquent is awesome as a RAD tool, because it's really flexible, making things like fetching relationships from the view possible. When I use Eloquent or ActiveRecord, I usually use it to its full potential, without overengineering things to much with repositories or so on. Or switch to a Data Mapper if I want a strict separation of concerns.

Just to say, for me i think leaking a little 'logic' in the view is ok, in 90% cases, unless you plan to reuse them in a non-laravel application (or even non-php), in which case you probably won't be using blade anyway.


Thanks Remi.

What I'm choosing to move forward with is have the repository classes return multidimensional arrays, and the views only reference $view_data['client_name'] or $client_pets['pet_name'].

But I agree, I do not see ever moving away from Eloquent models, and certainly not Laravel.


RemiCollin This is the smartest thing I've heard on this forum lately. +1


Sign in to participate in this thread!


Your banner here too?

unohuim unohuim Joined 1 Sep 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.