58 lines
1.3 KiB
PHP
Executable File
58 lines
1.3 KiB
PHP
Executable File
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class UserDocumentAcceptance extends Model
|
|
{
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var list<string>
|
|
*/
|
|
protected $fillable = [
|
|
'user_id',
|
|
'legal_document_id',
|
|
'document_version',
|
|
'ip_address',
|
|
'user_agent',
|
|
'accepted_at',
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be cast.
|
|
*
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'accepted_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the user that accepted the document.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\App\Models\User, \App\Models\UserDocumentAcceptance>
|
|
*/
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class);
|
|
}
|
|
|
|
/**
|
|
* Get the legal document that was accepted.
|
|
*
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\App\Models\LegalDocument, \App\Models\UserDocumentAcceptance>
|
|
*/
|
|
public function document(): BelongsTo
|
|
{
|
|
return $this->belongsTo(LegalDocument::class, 'legal_document_id');
|
|
}
|
|
}
|