init commit
This commit is contained in:
commit
c9d982669a
461 changed files with 30317 additions and 0 deletions
66
app/Models/BreakPeriod.php
Normal file
66
app/Models/BreakPeriod.php
Normal file
|
@ -0,0 +1,66 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
|
||||
class BreakPeriod extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'competition_id',
|
||||
'field_id',
|
||||
'name',
|
||||
'description',
|
||||
'start_time',
|
||||
'end_time',
|
||||
'type',
|
||||
'status',
|
||||
'round',
|
||||
'match_slot',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'start_time' => 'datetime',
|
||||
'end_time' => 'datetime',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the competition that this break period belongs to.
|
||||
*/
|
||||
public function competition(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Competition::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the field that this break period belongs to.
|
||||
*/
|
||||
public function field(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(Field::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the teams that are on break during this period.
|
||||
*/
|
||||
public function teams(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Team::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue