<?php

namespace App\Models;

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

class Admin extends Model
{
    use HasFactory;

    protected $table = "ticket";

    protected $fillable = [
        'ticket_id',
        'nameteam1',
        'nameteam2',
        'date',
        'time',
        'stadium',
        'category',
        'image1',
        'image2',
        'max_tickets',
        'available_tickets',
        'is_available',
    ];

    // Relationship: A ticket belongs to a user
    public function user()
    {
        return $this->belongsTo(User::class, 't_id');
    }

    // Relationship: A ticket can have many payments
    public function payments()
    {
        return $this->hasMany(Payment::class, 'ticket_id');
    }
    public function seatTypes()
    {
        return $this->hasMany(SeatType::class, 'ticket_id');
    }
}
