I have some tables, one of which is a table named Users
where there are soft deleted rows.
I have code like:
$appointments = Appointment
I'm not 100% sure this works, as this method is meant for adding constraints to eager-loading, but you may want to try it:
$appointments = Appointment::with(array('user' => function($query) {
$query->withTrashed();
}))->get();
This should apply withTrashed() to the query that grabs the users as opposed to the query which grabs the appointments.
Oh and just to clarify, you can add withTrashed() to both queries:
$appointments = Appointment::with(array('user' => function($query) {
$query->withTrashed();
}))->withTrashed()->get();
Edit: just thought of an easier method:
Add withTrashed() to the user() relationship (only do this if you want this to apply EVERY time you call this relationship):
public function user() {
return $this->hasOne('User')->withTrashed();
}