File: /var/www/vhost/disk-apps/teamdemo.sports-crowd.com/app/Ticket.php
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Ticket extends Model
{
protected $guarded = ['id', 'created_at', 'updated_at'];
public function seat()
{
return $this->belongsTo(Seat::class)->select('id', 'code', 'active', 'letter_id', 'zone_id')->with(['letter', 'zone']);
}
public function match_event()
{
return $this->belongsTo(MatchEvent::class)->with('team', 'season');
}
public function ticket_type()
{
return $this->belongsTo(TicketType::class)->select('id', 'name');
}
public function zone()
{
return $this->belongsTo(Zone::class)->with('door');
}
public function user()
{
return $this->belongsTo(User::class)->with('userInfo')->withTrashed();
}
public function ticket_status()
{
return $this->belongsTo(TicketStatus::class)->select('id', 'name');
}
public function ticket_main()
{
return $this->belongsTo(TicketMain::class);
}
public function ticket_validation_history()
{
return $this->hasMany(TicketValidationHistory::class);
}
public function ticket_user_log()
{
return $this->hasMany(TicketUserLog::class)->orderBy('created_at', 'desc');
}
}