Saturday, May 19, 2018

View not loading when called from a Controller in Laravel - development

View not loading when called from a Controller in Laravel

I created a controller using artisan in my Laravel application, here’s the code:

<?php

namespace AppHttpControllers;

use IlluminateHttpRequest;

class NavigationController extends Controller {

    public function welcome() {
        return view("welcome");
    }

}

When I use a Closure or load the view directly, everything works fine. But, when I load view from inside a controller, it couldn’t find it. Here’s my web.php file’s code:

Route::get('/', function () {
    return view('NavigationController@welcome');
});

The error it shows:
InvalidArgumentException View [NavigationController@welcome] not found.



from Laravel Questions and Answers https://laravelquestions.com/php/view-not-loading-when-called-from-a-controller-in-laravel/
via Lzo Media

No comments:

Post a Comment