<?php

namespace App\Models\Management;

use App\Models\User;
use App\Models\coreApp\BaseModel;
use App\Models\Traits\BranchTrait;
use App\Models\coreApp\Status\Status;
use App\Models\Management\ProjectFileComment;
use Illuminate\Database\Eloquent\Relations\HasMany;
use Illuminate\Database\Eloquent\Factories\HasFactory;

class ProjectFile extends BaseModel
{
    use HasFactory,BranchTrait;

    public function comments(): HasMany
    {
        return $this->hasMany(ProjectFileComment::class)->with('user:id,avatar_id','childComments');
    }

    //show_to_customer
    public function visitCustomer()
    {
        return $this->belongsTo(Status::class, 'show_to_customer');
    }

    // user
    public function user()
    {
        return $this->belongsTo(User::class);
    }
}
