Creating relationships between users/items/products

This commit is contained in:
2018-09-12 02:31:03 -03:00
parent 0f15e60c95
commit a905d98304
8 changed files with 25 additions and 27 deletions

View File

@@ -13,6 +13,11 @@ class Item extends Model
return $this->belongsTo(Product::class);
}
public function users()
{
return $this->belongsToMany(User::class);
}
public function free($product_id, $user_id)
{
return $query->where([