love_php/app/Traits/HasPreviews.php
2026-04-02 09:20:51 +08:00

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);
// }
}