$files->sortBy($field, $direction = 'asc', $method = SORT_REGULAR)

Sorts the files in the collection by field and direction

  • return ($files)
<ul>
  <?php foreach($page->files()->sortBy('modified', 'desc') as $file): ?>
  <li>
    <a href="<?= $file->url() ?>">
      <?= html($file->filename()) ?>
    </a>
  </li>
  <?php endforeach ?>
</ul>