22 lines
398 B
PHP
22 lines
398 B
PHP
|
|
<?php
|
||
|
|
declare(strict_types=1);
|
||
|
|
|
||
|
|
namespace App\Traits;
|
||
|
|
|
||
|
|
|
||
|
|
use App\Models\Preview;
|
||
|
|
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||
|
|
|
||
|
|
trait HasPreviews
|
||
|
|
{
|
||
|
|
public function previews():MorphMany
|
||
|
|
{
|
||
|
|
return $this->morphMany(Preview::class, 'previewable');
|
||
|
|
}
|
||
|
|
|
||
|
|
// public function primaryId(): string
|
||
|
|
// {
|
||
|
|
// return (string)$this->getAttribute($this->primaryKey);
|
||
|
|
// }
|
||
|
|
}
|