Xpressengine\Storage\File::getByFileable PHP Method

getByFileable() public static method

Get the files for fileable
public static getByFileable ( string $fileableId ) : Illuminate\Database\Eloquent\Collection | static[]
$fileableId string fileable identifier
return Illuminate\Database\Eloquent\Collection | static[]
    public static function getByFileable($fileableId)
    {
        $model = new static();
        return $model->newQuery()->rightJoin($model->getFileableTable(), $model->getTable() . '.id', '=', $model->getFileableTable() . '.fileId')->where('fileableId', $fileableId)->select([$model->getTable() . '.*'])->get();
    }

Usage Example

 public function getKeyFile()
 {
     if (!$this->file && $this->get('uuid')) {
         $files = File::getByFileable($this->get('uuid'));
         $this->file = $files->first();
     }
     return $this->file;
 }
All Usage Examples Of Xpressengine\Storage\File::getByFileable