<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class ContestHistory extends Model
{
    use HasFactory;

    protected $table = 'contest_history';

    protected $primaryKey = 'id';

    protected $fillable = [
        'user_id',
        'username',
        'contest_name',
        'rank',
        'reward',
        'created_at',
        'updated_at'
    ];

    public $timestamps = true;

    protected $casts = [
        'created_at' => 'datetime',
        'updated_at' => 'datetime'
    ];

    // Relationship with User model (if you have one)
    public function user()
    {
        return $this->belongsTo(User::class, 'user_id');
    }
}
