Support the ongoing development of Laravel.io →
Installation Configuration
Last updated 2 years ago.
0

You're slightly misinterpreting this. The controller class still has only one responsibility - that is handing the requests for a specific resource.

The way you seem to be looking at this is that each controller should only have a single function which in an of itself should show you that there is something wrong here.

Last updated 2 years ago.
0

So much wut. Do you put a single method in all your classes? :o

Last updated 2 years ago.
0

SRP says nothing about the number of methods in a class. SRP has more to do about the actors (stakeholders) involved.

I highly recommend Uncle Bob's video series at http://cleancoders.com Start at the very beginning and watch them all carefully. Alternatively, the book Clean Code has the same information. I personally prefer the video content during lunch, etc.

There's a lot to misunderstand about object-oriented design. Be careful.

Last updated 2 years ago.
0

No but it says a class should have only 1 reason to change.

If there are 5 methods there then there are many reasons to change the class.

Last updated 2 years ago.
0

I don't know if trolling..

Last updated 2 years ago.
0

robclancy said:

You're an idiot.

Have respect this is public forum there is no reason to be rude. If you don't agree just write your comment.

Last updated 2 years ago.
0

behnampmdg3 said:

robclancy said:

You're an idiot.

Have respect this is public forum there is no reason to be rude. If you don't agree just write your comment.

l2troll

Last updated 2 years ago.
0

Troll means ignore?

Last updated 2 years ago.
0

Couldn't understand your point of view, but since that i born, classes r supposed to have more than 1 method. I have never saw a class with just 1 method in a complete software.

Last updated 2 years ago.
0

behnampmdg3, you are about right, but a class has most times more then 1 method, even in SRP. Your class should have a single responsibility. Put onto the laravel controllers, each controller is repsonsibile for 1 route/resource, like, DashboardController, takes care of all dashboard access, or the LoginController about the login

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

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.