Laravel 5.3学习if语句

I'm just practicing at the moment and just wondering if someone can point me in the right direction.

Why would this return a blank page if no results are found, if i put an item in the database it returns the item.

Route::get('/read', function (){

    $posts = Post::all();

    if(empty($posts)) {
        echo "No Posts Exist";

    } else {

        foreach ($posts as $post) {
            return $post->title;
        }
    }

});

all() returns a collection. Many ways to skin this cat, but I think you're looking for isEmpty()

if($posts->isEmpty()) { ... } 

Other options would be ->count() === 0. Collection methods are listed here: https://laravel.com/docs/5.3/collections