<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class Group extends Model
{
	public function transactions()
    {
        return $this->belongsToMany(Transaction::class, GroupTransaction::class);
    }

    /**
     * @return BelongsTo
     */
    public function currency(): BelongsTo
    {
        return $this->BelongsTo(Currency::class, 'currency_id', 'id');
    }

    /**
     * @return BelongsTo
     */
    public function original_currency(): BelongsTo
    {
        return $this->BelongsTo(Currency::class, 'original_currency_id', 'id');
    }
}
