提交代码
This commit is contained in:
23
app/Models/Cart.php
Normal file
23
app/Models/Cart.php
Normal file
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Auth;
|
||||
|
||||
class Cart extends Model
|
||||
{
|
||||
public function goods()
|
||||
{
|
||||
return $this->belongsTo(Goods::class, 'goods_id', 'id');
|
||||
}
|
||||
|
||||
public function params()
|
||||
{
|
||||
return $this->belongsTo(GoodsParams::class, 'params_id', 'id');
|
||||
}
|
||||
|
||||
public function scopeMine($query)
|
||||
{
|
||||
return $query->where('user_id', Auth::id());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user