$file->prev()
Returns the previous item in the collection if available
$file->prev(): Kirby\Cms\Model|null
Return type
Kirby\Cms\Model
|null
Example
if(($file = $page->file('my-file.pdf')) && $prev = $file->prev()):
echo 'Previous file: ' . $prev->filename();
endif;