<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class NewRandD extends Model
{
    protected $table = 'new_randd';

    public static function boot()
    {
        parent::boot();

        self::creating(function($model){
        });

        self::created(function($model){
            auth()->user()->addActivityComplete(1060,$model);
        });

        self::updating(function($model){
            auth()->user()->addActivityComplete(1061,$model);
        });

        self::updated(function($model){
        });

        self::deleting(function($model){
            auth()->user()->addActivityComplete(1062,$model);
        });

        self::deleted(function($model){
        });
    }

    protected $fillable = [
        'title',
        'province_id',
        'province_fa',
        'domain_fa',
        'domain_id',
        'project_amount',
        'credit_status',
        'rfp_file',
        'unique_code',
        'created_time_jalali',
        'fname_creator',
        'lname_creator',
        'phone_creator',
        'operation_status',
        'proj_credit_resourse',
        'unique_id',
        'project_status'
    ];

    public function province()
    {
        return $this->belongsTo(Province::class, 'province_id');
    }
}