<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class Proposal extends Model
{

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

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

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

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

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

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

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

    protected $fillable = [
        'project_title',
        'project_type_id',
        'project_type_fa',
        'office_id',
        'office_fa',
        'province_id',
        'province_fa',
        'axis_type_id',
        'axis_type_fa',
        'axis_name',
        'followup_priority_project_id',
        'followup_priority_project',
        'priority_project',
        'priority_project_fa',
        'status_id',
        'status_fa',
        'operation_type_id1',
        'operation_type_fa1',
        'operation_type_unit1',
        'operation_type_amount1',
        'operation_type_id2',
        'operation_type_fa1',
        'operation_type_unit1',
        'operation_type_amount2',
        'operation_type_id3',
        'operation_type_fa1',
        'operation_type_unit1',
        'operation_type_amount3',
        'operation_type_id4',
        'operation_type_fa1',
        'operation_type_unit1',
        'operation_type_amount4',
        'start_lat',
        'end_lat',
        'start_lng',
        'end_lng',
        'user_id',
        'user_description',
        'national_credit',
        'province_credit',
        'created_at_fa',
        'updated_at_fa',
        'unique_code',
    ];


    public function user()
    {
        return $this->belongsTo('App\Models\User');
    }
}