<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Referral extends Model
{
    protected $fillable = ['hashed', 'raw', 'owner_id', 'saldo', 'used_by', 'is_used', 'role_type'];

    protected $casts = ['is_used' => 'boolean', 'saldo' => 'decimal:2'];

    public function owner()  { return $this->belongsTo(User::class, 'owner_id'); }
    public function usedBy() { return $this->belongsTo(User::class, 'used_by'); }
}
