| 1234567891011121314151617181920212223242526272829303132 |
- <?php
- namespace App;
- use App\CalendarGame;
- use Illuminate\Database\Eloquent\Model;
- class Team extends Model
- {
- protected $fillable = [
- 'name',
- 'penality',
- 'excluded',
- 'day',
- 'type',
- 'season_id'
- ];
- function getCalendar()
- {
- $game = CalendarGame::where('home_team_id', '=', $this->id)->first();
- $calendar = Calendar::where('id', '=', @$game->calendar_id)->first();
- return $calendar;
- }
- public function season()
- {
- return $this->belongsTo('App\Season');
- }
- }
|