Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

tanjilurrahman21's avatar

Design Patterns in Laravel

Is there any laracast video on design patterns like repository pattern? or why we should use design patterns ?

0 likes
5 replies
Tray2's avatar

I would suggest staying away from the repository pattern, it is usually just making the code more complex, and as a general rule of thumb, keep the code as simple as possible, as long as you can.

2 likes
tanjilurrahman21's avatar

I've been looking at job circulars some prefer modular pattern, some prefer repository. However, I am only used to writing queries and business logics in the controller.

jlrdw's avatar

I agree to stay away from the repository pattern, there are many past post on this.

Use MVC and stick to laravel conventions.

I might have a class I call for a complex search, just to keep the controller lean.

I like the KISS technique. https://en.wikipedia.org/wiki/KISS_principle

Learn to let the database do it's job.

1 like
Tray2's avatar

Learn to let the database do it's job

I whole heartedly agree with this one.

I 'm also a big fan of the KISS principle.

1 like

Please or to participate in this conversation.