35 lines
No EOL
1.2 KiB
PHP
35 lines
No EOL
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Relations\MorphPivot;
|
|
|
|
/**
|
|
* @property integer $id Id of the document.
|
|
* @property \App\Models\Document $document_id Name of the document.
|
|
* @property \App\Models\DocumentCategory|\App\Models\DocumentTag $documentable_id Name of the category or tag.
|
|
* @property class-string<static> $documentable_type Class of the category or tag.
|
|
* @property-read \Carbon\Carbon $created_at Created date of the document.
|
|
* @property-read \Carbon\Carbon $updated_at Updated date of the document.
|
|
*/
|
|
class Documentable extends MorphPivot
|
|
{
|
|
/**
|
|
* The table associated with the model.
|
|
*
|
|
* @var string|null
|
|
*/
|
|
protected $table = 'documentables';
|
|
|
|
/**
|
|
* Perform any actions required after the model boots.
|
|
*
|
|
* @return void
|
|
*/
|
|
protected static function booted(): void
|
|
{
|
|
static::created(fn() => Document::resetCache());
|
|
static::updated(fn() => Document::resetCache());
|
|
static::deleted(fn() => Document::resetCache());
|
|
}
|
|
} |