<?php

namespace App;

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

class LoopGroupUser extends Model
{

    /**
     * Field should be saved
     */
    protected $fillable = [
        'loop_group_id',
        'user_id',
        'share',
        'period',
        'encashment_month'
    ];

    /**
     * @return BelongsTo
     */
    public function loop_group() :BelongsTo
    {
        return $this->belongsTo(LoopGroup::class);
    }

    /**
     * @return HasMany
     */
    public function paids() :HasMany
    {
        return $this->hasMany(LoopGroupUserPaid::class);
    }

    /**
     * @return HasMany
     */
    public function invoices() :HasMany
    {
        return $this->hasMany(Invoice::class);
    }
}
