Skip to main content

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

Read more here
Premium Members Only
Join to unlock this tutorial and all of our courses.
Tutorial Premium Tutorial

Service Classes in Laravel: All You Need to Know

April 04, 2023
8 min read

Premium Members Only

This advanced tutorial is available exclusively to Laravel Daily Premium members.

Premium membership includes:

Access to all premium tutorials
Video and Text Courses
Private Discord Channel

Comments & Discussion

R
ripon52 ✓ Link copied!

how to use interfaces with the service file ?

D
Denis ✓ Link copied!

Thanks for such a useful article! Why not to use static methods in Service classes? In general, when and where should we use static methods?

PK
Povilas Korop ✓ Link copied!

It's a debatable thing, static methods usually mean that there's no specific object of that service/class and method doesn't rely on any other variables than itself.

In most cases, you CAN use static methods, but a general advice is that if you don't have specific reason to use static methods, you should not use them, as they may cause confusion in the future, potentially.

I guess it's worth separate article and video, adding to my to-do list.

DS
D.H SIMON ✓ Link copied!

Hello sir,

I'd like to know your recommendations about the best way to use UserService to handle Staff, Parent, Student, Vendor which belongTo 1 user; so that anytime any basic data info updated on User, the related Staff/Parent/Student/Vendor basic info also updated, and vice versa.

M
Modestas ✓ Link copied!

Hi, not sure what do you mean by this. Can you add more details about your case?

Specifically what data you are looking to update there and how the database looks like (rought connection/field example)