Skip to main content

Black Friday 2025! Only until December 1st: coupon FRIDAY25 for 40% off Yearly/Lifetime membership!

Read more here
Video

Laravel Code from Controller into Service: The Right Way

February 13, 2020

Enjoyed This Tutorial?

Get access to all premium tutorials, video and text courses, and exclusive Laravel resources. Join our community of 10,000+ developers.

Comments & Discussion

A
avrahamm ✓ Link copied!

This way all the long logic complexity is just moved one way down to the ReportService class. The long logic complexity was not splitted or simplified, just moved down. Is it worth it? Wouldn't it be better to try really split and simplify the logic and leave the simplified version in Controller method?

PK
Povilas Korop ✓ Link copied!

Good point, so I guess moving to service Service is the next step, and then that Service itself could be split into various sub-methods, later.