<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Review extends Model
{
    protected $table = 'reviews';
    protected $primaryKey = 'review_id';
    
    protected $fillable = [
        'produk_id', 
        'user_id', 
        'penjualan_id', 
        'rating', 
        'komentar'
    ];
    
    public $timestamps = true;
    
    public function produk()
    {
        return $this->belongsTo(Product::class, 'produk_id', 'produk_id');
    }
    
     public function user()
    {
        return $this->belongsTo(Users::class, 'user_id', 'user_id');
    }
    
    public function penjualan()
    {
        return $this->belongsTo(Penjualan::class, 'penjualan_id', 'penjualan_id');
    }
}