Fixed relationship to return actual assets

This commit is contained in:
snipe
2015-11-02 17:41:33 -08:00
parent 9cc542aea9
commit d0eed67c42
+2 -2
View File
@@ -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) {