imgmongelli /
mongicommerce
| 1 | <?php |
||
| 2 | |||
| 3 | |||
| 4 | namespace Mongi\Mongicommerce\Models; |
||
| 5 | |||
| 6 | |||
| 7 | use Illuminate\Support\Facades\Auth; |
||
| 8 | use Illuminate\Database\Eloquent\Model; |
||
| 9 | use Illuminate\Database\Eloquent\Factories\HasFactory; |
||
| 10 | |||
| 11 | class Cart extends Model |
||
| 12 | { |
||
| 13 | use HasFactory; |
||
| 14 | protected $table = 'cart'; |
||
| 15 | protected $dates = ["created_at","updated_at"]; |
||
| 16 | |||
| 17 | |||
| 18 | public function user(){ |
||
| 19 | return $this->belongsTo(User::class,'user_id'); |
||
| 20 | } |
||
| 21 | |||
| 22 | static function emptyCart(){ |
||
| 23 | self::where('user_id',Auth::user()->id)->delete(); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 24 | } |
||
| 25 | |||
| 26 | |||
| 27 | } |
||
| 28 |