<?php

namespace App\Models;

use Carbon\Carbon;
use Illuminate\Database\Eloquent\Model;

class ConfigHostel extends Model
{
    //
	protected $fillable = [
		'owner_id',
		'hostel_id',
		'voucher',
		'contract',
		'signature',
		'created_at',
		'updated_at'
	];

	protected $dates = [
		'created_at',
		'updated_at'
	];

	public function getVoucherAttribute()
    {
        $voucher = $this->attributes['voucher'];
        $voucher = str_replace('{days}', Carbon::now()->addDays(3)->format('d/m/Y'), $voucher);
        return $voucher;
    }
    public function getVoucherTextAttribute($hostelId)
    {
        return $this->attributes['voucher'];
    }
}
