Alimentalos/Backend

View on GitHub
relationships/src/Commentable.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
<?php

namespace Alimentalos\Relationships;

use App\Models\Comment;
use Illuminate\Database\Eloquent\Relations\MorphMany;

trait Commentable
{
    /**
     * The resource related comments.
     *
     * @return MorphMany
     */
    public function comments()
    {
        return $this->morphMany(Comment::class, 'commentable','commentable_type','commentable_id','uuid');
    }
}