mirror of
https://github.com/brunofontes/shareit.git
synced 2024-11-23 20:10:52 +00:00
26 lines
444 B
PHP
26 lines
444 B
PHP
<?php
|
|
|
|
namespace App;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Item extends Model
|
|
{
|
|
protected $fillable = ['product_id', 'name'];
|
|
|
|
public function product()
|
|
{
|
|
return $this->belongsTo(Product::class);
|
|
}
|
|
|
|
public function free($product_id, $user_id)
|
|
{
|
|
return $query->where([
|
|
['user_id', $user_id],
|
|
['product_id', $product_id],
|
|
['usedBy', ''],
|
|
]);
|
|
}
|
|
|
|
}
|