Reference

Guide

$file->next()

Returns the next item in the collection if available

$file->next(): Model|null

Return type

Model|null

Example

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

Source code

kirby/src/Cms/HasSiblings.php#L32