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