Support the ongoing development of Laravel.io →
posted 8 years ago
Architecture
Last updated 1 year ago.
0

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.

0

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.

0

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

0

Sign in to participate in this thread!

Eventy

Your banner here too?

unohuim unohuim Joined 1 Sep 2014

Moderators

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

Your logo here?

Laravel.io

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

© 2024 Laravel.io - All rights reserved.