<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

/**
 * App\Models\TravelProgramDraft
 *
 * @property int $id
 * @property int $travel_program_id
 * @property int $travel_class_id
 * @property int $draft_id
 * @property array $weekdays
 * @property \Illuminate\Support\Carbon|null $created_at
 * @property \Illuminate\Support\Carbon|null $updated_at
 * @property-read \App\Models\Draft $draft
 * @property-read \App\Models\TravelClass $travel_class
 * @property-read \App\Models\TravelProgram $travel_program
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgramDraft whereCreatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgramDraft whereDraftId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgramDraft whereId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgramDraft whereTravelClassId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgramDraft whereTravelProgramId($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgramDraft whereUpdatedAt($value)
 * @method static \Illuminate\Database\Eloquent\Builder|\App\Models\TravelProgramDraft whereWeekdays($value)
 * @mixin \Eloquent
 */
class TravelProgramDraft extends Model
{
    //use the connection to sec. Datebase sterntours
    protected $connection = 'mysql_stern';

    protected $table = 'travel_program_drafts';

    protected $casts = ['weekdays' => 'array'];

    protected $fillable = [
        'travel_program_id',
        'travel_class_id',
        'draft_id',
        'weekdays',
    ];


    public function travel_program()
    {
        return $this->belongsTo('App\Models\TravelProgram', 'travel_program_id');
    }
    public function travel_class()
    {
        return $this->belongsTo('App\Models\TravelClass', 'travel_class_id');
    }
    public function draft()
    {
        return $this->belongsTo(Draft::class, 'draft_id', 'id');
    }
}
