You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
monitor-doc/app/Models/Document.php

54 lines
1.0 KiB
PHTML

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Document extends Model
{
use HasFactory;
protected $fillable = [
'no',
'no_doc',
'type_doc_id',
'company_name',
'first_person_name',
'second_person_name',
'start_date',
'end_date',
'department_id',
'pic_name',
'email',
'note',
'document',
'status',
'user_id',
];
protected $cast = [
'start_date' => 'date',
'end_date' => 'date'
];
public const ACTIVE = 0;
public const UPDATE = 1;
public const EXPIRED = 2;
public function department()
{
return $this->belongsTo(Department::class, 'department_id');
}
public function type()
{
return $this->belongsTo(TypeDoc::class, 'type_doc_id');
}
public function creator()
{
return $this->belongsTo(User::class, 'user_id');
}
}