1 year ago

How to modify relationships loaded using with()

Posted 1 year ago by DocTolly

How could I modify a relationship loaded through the with() method. For example, if I wish to apply a presenter (hemp/presenter) to the staff relationship loaded here

$duties = $this->job->duties()->someRandomScope()->with('staff')->get();

I can easily apply a presenter to the duties:


How could I apply a presenter to the Staff relationship?

EDIT: just to add, the reason I want to present them now, is because I am outputting straight as Json

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