mirror of
https://github.com/brunofontes/shareit.git
synced 2025-11-15 07:50:54 -03:00
Imrpoving Item, Product and Users
This commit is contained in:
14
app/Item.php
14
app/Item.php
@@ -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', ''],
|
||||
]);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user