<?php

namespace App\Models;

use App\Casts\Hash;
use App\Classes\Common;
use App\Models\BaseModel;

class EmployeeDocument extends BaseModel
{
    protected $table = 'employee_documents';

    protected $default = ['xid'];

    protected $guarded = ['id', 'created_at', 'updated_at'];

    protected $hidden = ['id'];

    protected $appends = ['xid'];

    protected $fillable = [
        'user_id',
        'category_id',
        'document_type_id',
        'title',
        'description',
        'file_path',
    ];

  
    public function category()
    {
        return $this->belongsTo(DocumentCategory::class, 'category_id');
    }

    
    public function type()
    {
        return $this->belongsTo(DocumentType::class, 'document_type_id');
    }

    
    public function employee()
    {
        return $this->belongsTo(User::class, 'user_id');
    }

    // public function getempDocumentUrlAttribute()
    // {
    //     $DocumentPath = Common::getFolderPath('DocumentPath');

    //     return $this->file_path == null ? null : Common::getFileUrl($DocumentPath, $this->file_path);
    // }
}
