'datetime:Y-m-d H:i:s' ]; protected $fillable = [ 'state', 'score', 'score_type' ]; public function scopeShow($q) { $q->where('state', '>' ,0); } public function scopeSort($q) { $q->orderBy('game_at', 'desc')->orderBy('created_at', 'desc'); } public function logs() { return $this->hasMany(UserGame::class, 'game_id'); } public function activity() { return $this->belongsTo(Activity::class, 'activity_id'); } }