First Commit
This commit is contained in:
Executable
+58
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||
|
||||
class LegalDocument extends Model
|
||||
{
|
||||
/**
|
||||
* The attributes that are mass assignable.
|
||||
*
|
||||
* @var list<string>
|
||||
*/
|
||||
protected $fillable = [
|
||||
'type',
|
||||
'title',
|
||||
'content',
|
||||
'version',
|
||||
'published_at',
|
||||
'published_by',
|
||||
];
|
||||
|
||||
/**
|
||||
* The attributes that should be cast.
|
||||
*
|
||||
* @return array<string, string>
|
||||
*/
|
||||
protected function casts(): array
|
||||
{
|
||||
return [
|
||||
'published_at' => 'datetime',
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user that published the document.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\App\Models\User, \App\Models\LegalDocument>
|
||||
*/
|
||||
public function publishedBy(): BelongsTo
|
||||
{
|
||||
return $this->belongsTo(User::class, 'published_by');
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the user document acceptances for the legal document.
|
||||
*
|
||||
* @return \Illuminate\Database\Eloquent\Relations\HasMany<\App\Models\UserDocumentAcceptance, \App\Models\LegalDocument>
|
||||
*/
|
||||
public function acceptances(): HasMany
|
||||
{
|
||||
return $this->hasMany(UserDocumentAcceptance::class);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user