<?php
namespace App;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;

/**
 * Class RoomCount
 *
 * @package App
 * @property integer $count
 * @property string $code
 * @method static bool|null forceDelete()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\RoomCount newModelQuery()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\RoomCount newQuery()
 * @method static \Illuminate\Database\Query\Builder|\App\RoomCount onlyTrashed()
 * @method static \Illuminate\Database\Eloquent\Builder|\App\RoomCount query()
 * @method static bool|null restore()
 * @method static \Illuminate\Database\Query\Builder|\App\RoomCount withTrashed()
 * @method static \Illuminate\Database\Query\Builder|\App\RoomCount withoutTrashed()
 * @mixin \Eloquent
 */
class RoomCount extends Model
{
    use SoftDeletes;

    protected $fillable = ['count', 'code'];
    protected $hidden = ['created_at', 'updated_at', 'deleted_at', 'pivot'];

    /**
     * Set attribute to money format
     * @param $input
     */
    public function setCountAttribute($input)
    {
        $this->attributes['count'] = $input ? $input : null;
    }

    /**
     * Get the user's full name.
     *
     * @return string
     */
    public function getNameAttribute()
    {
        return "{$this->count}-кімнатні";
    }
}
