<?php

namespace App\Models;

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

class Contract extends Model
{
    use HasFactory;

    protected $fillable = [
        'name',
        'description',
        'type',
        'sub_type',
        'status',
        'content',
    ];
    public function companies()
    {
        return $this->belongsToMany(Company::class);
    }

    public function plan()
    {
        return $this->belongsTo(Plan::class);
    }

    public function getTypeNameAttribute()
    {
        return DataTypeContract($this->type);
    }

    public function getSubTypeNameAttribute()
    {
            return DataSubTypeContract($this->sub_type);
    }

}
