<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class Referral extends Model
{
    use HasFactory;

    protected $fillable = [
        'user_id',          // ID si pengundang
        'referred_user_id', // ID si pendaftar baru
        'deposit_amount',
        'bonus',
    ];

    // 🔹 Relasi ke user pengundang
    public function referrer()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

    // 🔹 Relasi ke user yang diundang
    public function referredUser()
    {
        return $this->belongsTo(User::class, 'referred_user_id');
    }
}
