<?php

namespace App\Models;

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

class BatchInvitationLink extends Model
{
    // use HasFactory;
    protected $table = 'batch_invitation_links';
    protected $fillable = [
        'company_id',
        'expired',
        'expiry_date',
        'locked',
        'max_registrants',
        'name',
        'rate',
        'token',
        'total_registrants'
    ];
    public function roles()
    {
        return $this->hasMany('App\Models\BatchInvitationLinkRole', 'batch_invitation_link_id', 'id', 'roles.id')
            ->join('roles', 'roles.id', '=', 'batch_invitation_link_roles.role_id')
            ->orderBy('roles.id', 'asc');
    }
}
