init commit
This commit is contained in:
commit
c9d982669a
461 changed files with 30317 additions and 0 deletions
64
app/Models/Field.php
Normal file
64
app/Models/Field.php
Normal file
|
@ -0,0 +1,64 @@
|
|||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class Field extends Model
|
||||
{
|
||||
use HasFactory;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var array<int, string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'name',
|
||||
'location',
|
||||
'description',
|
||||
'status',
|
||||
'capacity',
|
||||
'surface_type',
|
||||
'indoor',
|
||||
'dimensions',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @var array<string, string>
|
||||
*/
|
||||
protected $casts = [
|
||||
'indoor' => 'boolean',
|
||||
'dimensions' => 'array',
|
||||
];
|
||||
|
||||
/**
|
||||
* Get the competitions that use this field.
|
||||
*/
|
||||
public function competitions(): BelongsToMany
|
||||
{
|
||||
return $this->belongsToMany(Competition::class)
|
||||
->withTimestamps();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the matches scheduled on this field.
|
||||
*/
|
||||
public function matches(): HasMany
|
||||
{
|
||||
return $this->hasMany(MatchGame::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the break periods scheduled on this field.
|
||||
*/
|
||||
public function breakPeriods(): HasMany
|
||||
{
|
||||
return $this->hasMany(BreakPeriod::class);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue