<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

use Carbon\Carbon;

class Block extends Model
{
    
	protected $dates = ['deleted_at', 'day'];
	
	protected $fillable = [
		'reason',
		'day',
		'boat_id',
		'schedule_id',
	];
	
	public function setDayAttribute($date){
		$this->attributes['day'] = Carbon::parse($date);
	}
	
	public function getDayAttribute($date){
		return Carbon::parse($date)->format('m/d/Y');
	}
	
	public function getDayFormat($date){
		return Carbon::parse($date)->format('d/m/Y');
	}
	
	public function boat()
	{
		return $this->belongsTo('App\Boat');
	}

	public function schedule()
	{
		return $this->belongsTo('App\Schedule', 'schedule_id');
	}


}
