2024-01-07 02:02:50 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
|
|
|
|
class Document extends Model
|
|
|
|
{
|
|
|
|
use HasFactory;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The attributes that are mass assignable.
|
|
|
|
*
|
|
|
|
* @var array<int, string>
|
|
|
|
*/
|
|
|
|
protected $fillable = [
|
|
|
|
'type',
|
|
|
|
'doc_number',
|
2024-01-08 22:25:01 +01:00
|
|
|
'doc_type',
|
|
|
|
'doc_certifier'
|
2024-01-07 02:02:50 +01:00
|
|
|
];
|
|
|
|
|
|
|
|
/**
|
|
|
|
* The attributes that should be cast.
|
|
|
|
*
|
|
|
|
* @var array<string, string>
|
|
|
|
*/
|
|
|
|
protected $casts = [
|
2024-01-08 22:25:01 +01:00
|
|
|
'date' => 'datetime',
|
2024-01-07 02:02:50 +01:00
|
|
|
'expiration_date' => 'datetime'
|
|
|
|
];
|
|
|
|
|
2024-01-08 22:25:01 +01:00
|
|
|
public function user(): BelongsTo
|
|
|
|
{
|
|
|
|
return $this->belongsTo(User::class);
|
|
|
|
}
|
|
|
|
|
2024-01-07 02:02:50 +01:00
|
|
|
public function addedBy(): BelongsTo
|
|
|
|
{
|
|
|
|
return $this->belongsTo(User::class);
|
|
|
|
}
|
|
|
|
|
|
|
|
public function documentFile(): BelongsTo
|
|
|
|
{
|
|
|
|
return $this->belongsTo(DocumentFile::class);
|
|
|
|
}
|
|
|
|
}
|