If a page contains an image, I get no error. If a page does not contain an image I get the following. Fatal error: Exception: Invalid type to Pageimages::remove(item) message. Any suggestions is appreciated.
my code:
$first = $page->image->first;
if (count($page->image) > 1) {
echo "<h4>$page->title</h4>";
}
foreach($page->image->remove($first) as $img) {
if ($img) {
echo "<img src='{$img->url}' />";
}
}