$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="<?php echo $file->url() ?>">
      <?php echo html($file->filename()) ?>
    </a>
  </li>
  <?php endforeach ?>
</ul>