with() and leftjoin() in Laravel

Published 7 months ago by afoysal

How can I use both with() and leftjoin() in Laravel eloquent? I would like to use in below code.

$applicants = Applicant::with('applicant_skill')->paginate();

bashy
bashy
7 months ago (1,002,020 XP)

Just chain it?

afoysal

How can I chain it?

vladshoob

@afoysal , @bashy ment this.

$applicants = Applicant::leftJoin()->with('applicant_skill')->paginate();
bashy
bashy
7 months ago (1,002,020 XP)

paginate() has been chained. Depends what you want to do and if it's the same table or not.

Please sign in or create an account to participate in this conversation.