DEV Community

loading...

Discussion on: Becoming a better Laravel developer by using the SOLID design principles. Part 1

Collapse
abrardev99 profile image
Abrar Ahmad Author

As I explained in article, we are going to see SOLID principle in context of Laravel. So I gave example from Laravel and how to achive "every entity should have single responsibility".

As controller store method meant to store data not validation of data.

So we extract validation logic to seprate class called Request and in this way we implemented single responsibility principle.

Although there a tons of examples with general purpose code and with Laravel. But with laravel it is simple and easy to understand example.

Collapse
msamgan profile image
Mohammed Samgan Khan

now as you mentioned in comment "As controller store method meant to store data not validation of data.

So we extract validation logic to seprate class called Request and in this way we implemented single responsibility principle."

now its clear..

Thread Thread
abrardev99 profile image
Forem Open with the Forem app