<?php

namespace App\Models;

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

class Referral extends Model
{
    use HasFactory;

    /**
     * Get the inviter that owns the Referral
     *
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
     */
    public function inviter()
    {
        return $this->belongsTo(User::class, 'inviter_id');
    }

    /**
     * Get the invited that owns the Referral
    *
    * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
    */
    public function invited()
    {
        return $this->belongsTo(User::class, 'invited_id');
    }

    public function investment()
    {
        return $this->belongsTo(Investment::class);
    }

}
