Couldn't you use
if(is_a($images, 'IlluminateDatabaseEloquentCollection')) {
....do whatever for a collection....
} else {
....do whatever for not a collection....
}
Or
if ($images instanceof IlluminateDatabaseEloquentCollection) {
}
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…