Reference

Guide

$file->hasPrev()

Checks if there's a previous item in the collection

$file->hasPrev(): bool

Return type

bool

Example

$file = $page->file('myfile.pdf');

if($file && $file->hasPrev()) {
    echo 'Previous file: ' . $file->prev()->filename();
}

Source code

kirby/src/Cms/HasSiblings.php#L99