adding a cart
linter / quality (push) Has been cancelled
tests / ci (8.3) (push) Has been cancelled
tests / ci (8.4) (push) Has been cancelled
tests / ci (8.5) (push) Has been cancelled

This commit is contained in:
2026-04-10 08:54:20 -06:00
parent ebf30d4f5f
commit d9cb44e93c
16 changed files with 559 additions and 39 deletions
+27
View File
@@ -0,0 +1,27 @@
<?php
namespace App\Models;
use Database\Factories\CartFactory;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
class Cart extends Model
{
/** @use HasFactory<CartFactory> */
use HasFactory;
protected $fillable = ['user_id'];
public function user(): BelongsTo
{
return $this->belongsTo(User::class);
}
public function products(): BelongsToMany
{
return $this->belongsToMany(Product::class)->withPivot('quantity');
}
}