phpvms/app/Models/Traits/FilesTrait.php

24 lines
373 B
PHP
Raw Normal View History

<?php
namespace App\Models\Traits;
use App\Models\File;
trait FilesTrait
{
/**
* Morph to type of File
2018-08-27 00:40:04 +08:00
*
* @return mixed
*/
public function files()
{
return $this->morphMany(
File::class,
2018-08-27 00:40:04 +08:00
'files', // overridden by the next two anyway
'ref_model',
'ref_model_id'
);
}
}