From d0eed67c42334c094eefe65eb900d2fa8efaf93c Mon Sep 17 00:00:00 2001 From: snipe Date: Mon, 2 Nov 2015 17:41:33 -0800 Subject: [PATCH] Fixed relationship to return actual assets --- app/models/Location.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/Location.php b/app/models/Location.php index df49df8dbf..7364e1c3a2 100755 --- a/app/models/Location.php +++ b/app/models/Location.php @@ -21,7 +21,7 @@ class Location extends Elegant } public function assets() { - return $this->hasMany('Actionlog','location_id'); + return $this->hasManyThrough('Asset', 'Actionlog', 'location_id', 'id'); } public function assignedassets() { @@ -104,7 +104,7 @@ class Location extends Elegant ->orWhere('city', 'LIKE', "%$search%") ->orWhere('state', 'LIKE', "%$search%") ->orWhere('zip', 'LIKE', "%$search%") - + // This doesn't actually work - need to use a table alias maybe? ->orWhere(function($query) use ($search) { $query->whereHas('parent', function($query) use ($search) {