Imrpoving Item, Product and Users

This commit is contained in:
2018-09-11 20:48:09 -03:00
parent 4b3c2089f5
commit 0f15e60c95
17 changed files with 155 additions and 59 deletions

View File

@@ -6,12 +6,18 @@ use Illuminate\Database\Eloquent\Model;
class Item extends Model
{
//
public function free($productID, $userID)
protected $fillable = ['product_id', 'name'];
public function product()
{
return $this->belongsTo(Product::class);
}
public function free($product_id, $user_id)
{
return $query->where([
['userID', $userID],
['productID', $productID],
['user_id', $user_id],
['product_id', $product_id],
['usedBy', ''],
]);
}