Game.php 735 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. namespace App\Models;
  3. use Illuminate\Database\Eloquent\Model;
  4. use Nanigans\SingleTableInheritance\SingleTableInheritanceTrait;
  5. class Game extends Model
  6. {
  7. use SingleTableInheritanceTrait;
  8. protected $table = 'games';
  9. public $timestamps = true;
  10. protected static $singleTableTypeField = 'type';
  11. protected static $singleTableType = 'game';
  12. protected static $singleTableSubclasses = [Training::class];
  13. public function get_single_table_type()
  14. {
  15. return self::$singleTableType;
  16. }
  17. public function sentences()
  18. {
  19. return $this->belongsToMany('App\Models\Sentence');
  20. }
  21. public function user()
  22. {
  23. return $this->belongsTo('App\Models\User');
  24. }
  25. }