SportLeague.php 548 B

12345678910111213141516171819
  1. <?php
  2. namespace App\Models;
  3. class SportLeague extends BaseModel
  4. {
  5. protected $table = 'sport_league';
  6. protected $fillable = ['league_en', 'league_name', 'logo', 'status'];
  7. public $timestamps = true;
  8. protected $dateFormat = 'U'; // U 代表 UNIX 时间戳(int)
  9. // 2. 修改创建时间字段名为 create_time
  10. const CREATED_AT = 'create_time';
  11. const UPDATED_AT = 'update_time';
  12. public static function getLeagueName($league_en){
  13. return self::where(['league_en' => $league_en])->value('league');
  14. }
  15. }