Alimentalos/Backend

View on GitHub
relationships/src/Photoable.php

Summary

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

namespace Alimentalos\Relationships;

use App\Models\Photo;
use Illuminate\Database\Eloquent\Relations\BelongsToMany;

trait Photoable
{
    /**
     * The resource related photos.
     *
     * @return BelongsToMany
     */
    public function photos()
    {
        return $this->morphToMany(Photo::class, 'photoable','photoables','photoable_id','photo_uuid','uuid','uuid');
    }
}