<?php

namespace Modules\Admin\app\Models;

use App\Models\User;
use Illuminate\Database\Eloquent\Model;

class Criteria extends Model
{
    protected $table = 'criterias';
    protected $fillable = ['name', 'description', 'type'];

    public function sprints()
    {
        return $this->belongsToMany(Sprint::class, 'sprints_criterias')
            ->withPivot('point', 'expect_result', 'actual_result', 'note');
    }

    public function users()
    {
        return $this->belongsToMany(User::class, 'users_criterias')
            ->withPivot('point', 'note', 'sprint_id')
            ;
    }
}
