Reference

Guide

$file->prev()

Returns the previous item in the collection if available

$file->prev(): Model|null

Return type

Model|null

Example

if(($file = $page->file('my-file.pdf')) && $prev = $file->prev()):
    echo 'Previous file: ' . $prev->filename();
endif;

Source code

kirby/src/Cms/HasSiblings.php#L52