Joey93
Joey93

Reputation: 103

View not being found even though it exists in laravel

I am having issues with a view, other views work for me apart from this one. This is the route for it

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

Method in ProfileController

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

A snippet of the navbar Where I call route to it when the user clicks

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

The view is in the file structure as follows views/profile/avatarupload.blade.php

Finally here is the error code I get when I click on Update Avatar in the navbar

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

Upvotes: 1

Views: 267

Answers (1)

ceejayoz
ceejayoz

Reputation: 179994

You're mixing up route names and view names. They are not the same thing.

If your view is located at resources/views/profile/avatarupload.blade.php, you want to do return view('profile.avatarupload');

Upvotes: 2

Related Questions