2018-04-02 07:02:12 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace App\Models\Traits;
|
|
|
|
|
|
|
|
use App\Models\File;
|
|
|
|
|
|
|
|
trait FilesTrait
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* Morph to type of File
|
2018-08-27 00:40:04 +08:00
|
|
|
*
|
2018-04-02 07:02:12 +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
|
2018-04-02 07:02:12 +08:00
|
|
|
'ref_model',
|
|
|
|
'ref_model_id'
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|