You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

61 lines
1.2 KiB

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
class Reservation extends Model
{
use HasFactory;
protected $fillable = [
'venue_id',
'activity_id',
'activity_day_id',
'wechat_user_id',
'visitor_name',
'visitor_phone',
'id_card',
'ticket_count',
'ticket_mode',
'booking_type',
'qr_token',
'status',
'verified_by',
'verified_at',
'reservation_source',
];
protected $casts = [
'verified_at' => 'datetime',
'ticket_count' => 'integer',
];
public function venue(): BelongsTo
{
return $this->belongsTo(Venue::class);
}
public function activity(): BelongsTo
{
return $this->belongsTo(Activity::class);
}
public function activityDay(): BelongsTo
{
return $this->belongsTo(ActivityDay::class);
}
public function wechatUser(): BelongsTo
{
return $this->belongsTo(WechatUser::class);
}
public function verifier(): BelongsTo
{
return $this->belongsTo(User::class, 'verified_by');
}
}