Good morning, I need some advise about Laravel. I would like to know the main difference between "Repositorie Pattern" and "Traits" on controllers. I'm a little bit confuse about the security of them.
I you use Traits on your controllers, you can define auth middlewares on the constructors, so anyone who wants to access to the methods defined on the controller should be allowed by middleware. But, what happen if I use the same trait on another controller without auth middlewares? Anyone could access to the methods of that trait !?
By the other side, if you would like to use some repositories, you could accomplish the same objective with more cohesion and less coupling, but what happend if you call that repositorie in the constructor of another controller without auth middlewares?! What happend with the security of those methods?
So my question is, what would you guys recommend? I'm asking stupid things ? (could be right?) Which is your experience ? May someone malicious access those methods ?
How secure is the coupling of methods on traits and repositories that doesn't have auth middlewares ?
May I use middlewares on constructors of each trait and repositories? (This was my last thought, I will try it)
Thanks !
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2p3RJ0R
via IFTTT
Aucun commentaire:
Enregistrer un commentaire