Support the ongoing development of →
posted 10 years ago
Last updated 2 years ago.

You want to retrieve mortgages not products and event to check is MORTGAGE, CONTACTED, right?

Mortgage::whereHas('case', function($q) {
	$q->whereHas('events', function($q){
		$q->where('type', '=', 'CONTACTED'); // or better check for event id here, up to you
	}, '<', 1); // -> not having that event

// as long as you have the relations:

// Case model
public function events()
  return $this->belongsToMany('Event', 'cases_timeline')

// Mortgage model
public function case()
  return $this->belongsTo('Case');
Last updated 2 years ago.

Sign in to participate in this thread!


Your banner here too?

bweston92 bweston92 Joined 3 Feb 2014


We'd like to thank these amazing companies for supporting us

Your logo here?

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 - All rights reserved.