31 lines
539 B
PHP
31 lines
539 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Cart extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'cart';
|
|
|
|
protected $fillable = [
|
|
'id_user',
|
|
'id_product',
|
|
'jumlah',
|
|
'total_harga'
|
|
];
|
|
|
|
public function product()
|
|
{
|
|
return $this->belongsTo(Product::class, 'id_product', 'id');
|
|
}
|
|
|
|
public function user()
|
|
{
|
|
return $this->belongsTo(User::class, 'id_user', 'id');
|
|
}
|
|
}
|