]> git.localhorst.tv Git - alttp.git/blob - app/Models/Result.php
e4954195bb3969ceb3be8510f2e085de276b9dcf
[alttp.git] / app / Models / Result.php
1 <?php
2
3 namespace App\Models;
4
5 use Illuminate\Database\Eloquent\Factories\HasFactory;
6 use Illuminate\Database\Eloquent\Model;
7
8 class Result extends Model
9 {
10         use HasFactory;
11
12         public function round() {
13                 return $this->belongsTo(Round::class);
14         }
15
16         public function participant() {
17                 return $this->belongsTo(Participant::class);
18         }
19
20         public function getHasFinishedAttribute() {
21                 return $this->time > 0;
22         }
23
24         protected $appends = [
25                 'has_finished',
26         ];
27
28         protected $fillable = [
29                 'round_id',
30                 'time',
31                 'user_id',
32         ];
33
34 }