Define Entry and EntryTotalScore relationships
This commit is contained in:
parent
e79e7e222d
commit
8647a66df8
|
|
@ -17,16 +17,13 @@ class Entry extends Model
|
|||
|
||||
protected $guarded = [];
|
||||
|
||||
protected $hasCheckedScoreSheets = false;
|
||||
|
||||
public $final_scores_array; // Set by TabulationService
|
||||
|
||||
public $scoring_complete; // Set by TabulationService
|
||||
|
||||
public $is_doubler; // Set by DoublerService
|
||||
|
||||
protected $with = ['flags'];
|
||||
|
||||
public function totalScore(): HasOne
|
||||
{
|
||||
return $this->hasOne(EntryTotalScore::class);
|
||||
}
|
||||
|
||||
public function student(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Student::class);
|
||||
|
|
@ -98,7 +95,7 @@ class Entry extends Model
|
|||
|
||||
public function removeFlag($flag): void
|
||||
{
|
||||
// remove related auditionFlag where flag_name = $flag
|
||||
// remove the related auditionFlag where flag_name = $flag
|
||||
$this->flags()->where('flag_name', $flag)->delete();
|
||||
$this->load('flags');
|
||||
}
|
||||
|
|
@ -120,11 +117,6 @@ class Entry extends Model
|
|||
return $this->hasOne(Seat::class);
|
||||
}
|
||||
|
||||
public function calculatedScores(): HasMany
|
||||
{
|
||||
return $this->hasMany(CalculatedScore::class);
|
||||
}
|
||||
|
||||
public function scopeForSeating(Builder $query): void
|
||||
{
|
||||
$query->where('for_seating', 1);
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ namespace App\Models;
|
|||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
|
||||
class EntryTotalScore extends Model
|
||||
{
|
||||
|
|
@ -13,4 +14,9 @@ class EntryTotalScore extends Model
|
|||
'seating_subscore_totals' => 'json',
|
||||
'advancement_subscore_totals' => 'json',
|
||||
];
|
||||
|
||||
public function entry(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Entry::class);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue