Skip to content

Commit

Permalink
Fixed relationship to return actual assets
Browse files Browse the repository at this point in the history
  • Loading branch information
snipe committed Nov 3, 2015
1 parent 9cc542a commit d0eed67
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/models/Location.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public function users() {
}

public function assets() {
return $this->hasMany('Actionlog','location_id');
return $this->hasManyThrough('Asset', 'Actionlog', 'location_id', 'id');
}

public function assignedassets() {
Expand Down Expand Up @@ -104,7 +104,7 @@ public function scopeTextsearch($query, $search)
->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) {
Expand Down

0 comments on commit d0eed67

Please sign in to comment.