视图未被发现,即使它存在于laravel中


View not being found even though it exists in laravel

我的一个视图有问题,除此视图外,其他视图也适用于我。这是的路线

Route::get('/profile/avatarupload', [
    'uses' => ''App'Http'Controllers'ProfileController@getAvatarUpload',
    'as' => 'profile.avatar',
]);

ProfileController 中的方法

public function getAvatarUpload()
    {
        return view('profile.avatar');
    }

导航栏的一个片段,当用户点击时,我会调用它的路线

<li><a href="{{ route('profile.avatar') }}">Update Avatar</a></li>

视图的文件结构如下views/profile/avatarupload.blade.php

最后,这里是我点击导航栏中的更新头像时得到的错误代码

InvalidArgumentException in FileViewFinder.php line 137:
View [profile.avatar] not found. 

您混淆了路由名称和视图名称。它们不是一回事。

如果视图位于resources/views/profile/avatarupload.blade.php,则需要执行return view('profile.avatarupload');