<?php

namespace App\Models;

use App\Traits\Blameable;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

class Diskon extends Model
{
    use HasFactory, Blameable, SoftDeletes;

    protected $table = 'diskons';

    protected $fillable = [
        'nama_diskon',
        'kode_diskon',
        'diskon_persen',
        'diskon_rupiah',
    ];

    public function pesanan()
    {
        return $this->hasMany(Pesanan::class, 'diskon_id');
    }

    public function pesanan_detail()
    {
        return $this->hasMany(DetailPesanan::class, 'diskon_id');
    }

    public function produk()
    {
        return $this->hasMany(Produk::class, 'diskon_id');
    }
}
