35 lines
785 B
PHP
35 lines
785 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
class Ticket extends Model
|
|
{
|
|
|
|
protected $table = 'tickets';
|
|
protected $primaryKey = 'ticket_id';
|
|
protected $fillable = [
|
|
'order_id', // which order is this ticket for?
|
|
'showing_id', // which showing is this ticket for?
|
|
'seat_id', // which seat is the ticket for?
|
|
'price_id', // which price is this ticket?
|
|
'user_id', // who added the ticket?
|
|
];
|
|
|
|
protected $hidden = [
|
|
'created_at',
|
|
'updated_at',
|
|
];
|
|
|
|
public function order()
|
|
{
|
|
return $this->belongsTo(Order::class, 'order_id', 'order_id');
|
|
}
|
|
|
|
public function showing()
|
|
{
|
|
return $this->belongsTo(Showing::class, 'showing_id', 'showing_id');
|
|
}
|
|
|
|
}
|