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

Vincent1516's avatar

Laravel - How to check if relationship ("->with") is null.

So I have a simple query here: $query_fitsoa = FITSOA::where('status',1)->with('developer')->get();

my goal is to skip the FITSOA and not include in the query if 'developer' is empty/null.

0 likes
3 replies
Vincent1516's avatar

@Sinnbeck holy, just that simple. I think I been searching it in a wrong way., thank you. this helps a lot.

Please or to participate in this conversation.