21 lines
363 B
PHP
21 lines
363 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class EstimationRound extends Model
|
|
{
|
|
protected $fillable = ['token', 'max_score', 'max_voters'];
|
|
|
|
public function votes()
|
|
{
|
|
return $this->hasMany(Vote::class);
|
|
}
|
|
|
|
public function getAverageScoreAttribute()
|
|
{
|
|
return $this->votes->avg('score');
|
|
}
|
|
}
|