<?php

namespace App\Models;

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

class ScheduledMaintenance extends Model
{
    use HasFactory;
    
    public $timestamps = false;
    
    protected $fillable = [
            'name',
            'start_date',
            'to_date',
            'components',
            'status',
            'server_name',
            'schedule_status'
        ];
        
    protected $casts = [
        'components' => 'array'
        ];    


     public function CurrentMessage(){
        return $this->hasOne(ScheduledMessage::class)->orderBy('id' , 'desc');
     }
     
      public function FirstMessage(){
        return $this->hasOne(ScheduledMessage::class);
     }

     public function scheduled_message(){
        return $this->hasMany(ScheduledMessage::class);
    }







}
