View index not found in Laravel 5.3

Posted on

This is an article which is created to discuss an error generated as ‘View index not found in Laravel 5.3’. The error itself is explained in the following prove such as an image as follow :

View index not found in Laravel 5.3
View index not found in Laravel 5.3

Depends on the image which is shown above, the index file is actually located in the default folder which is intented and is used to store the files for view template. It is actually located in resources/views and furthermore to separate the web application into several specific modules, there will be another additional folder located inside ‘resources/views’ for an example an additional folder named ‘server’. So, the full path of the view file will be located in ‘resources/views/server’.

So, what is the main trigger which cause an error generated as ‘View index not found in Laravel 5.3’ ?. One of them is because the file named index which is normally located in the view folder as is in ‘resources/views’, specifically if the index file was made for certain module as explained in the above paragraph for an example, ‘server’ does not exist.

To solve the problem, there must be a file named index.blade.php located in ‘resources/views/server’. This is because the file named web.php which is located in routes folder is pointing out to execute index.php while accessing server module. The content is shown as follows :


So, what is actually happened when someone accessing URL which has part of ‘server’ for accessing server module ?. It is going to search for ServerController.php and executing for its default function named ‘index’. Below is the content of ServerController.php which is needed to be examined :

class ServerController extends Controller
#    use AuthorizesRequests, DispatchesJobs, ValidatesRequests;

         *  Display listing of Server

        public function index(Request $request)
                $list_server = Server::orderBy('id_server','DESC')->paginate(5);
                return view('server.index',compact('list_server'))
                        ->with('i', ($request->input('page',1) - 1) * 5);

As shown in the above snippet code which is extracted from a file named ServerController.php, it is clearly declared in the function named index which is going to be executed by default from someone executing directly the Server module by accessing through an URL of the web application which has the ‘server’ part, the view page which is used to render the output generated is ‘index.blade.php’ located in server folder. It is clearly specified by the line of code :

return view('server.index'....

One thought on “View index not found in Laravel 5.3

Leave a Reply