Search code examples
phpmodel-view-controllerdeploymentrouteslaravel-5.3

Laravel 3.5 - View [Index] Not Found


UPDATE END - PROBLEM SOLVED

The problem is that my server is not setting up properly because the domain doesnt connected properly to my VPS. Contacted the hosting provider and the problem solved.

If anyone have this problem just check

  1. Have you already doing php artisan config:cache or php artisan config:clear?
  2. Did you name your view correctly with yourview.blade.php?
  3. Did you place the view correctly in the resources\views?

I already deploy the laravel app into my VPS. It works fine on localhost. the error message is shown below:

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

1.  in FileViewFinder.php line 137
2.  at FileViewFinder->findInPaths('index', array('E:\Laravel\portofolio\resources\views')) in FileViewFinder.php line 79
3.  at FileViewFinder->find('index') in Factory.php line 174
4.  at Factory->make('index', array(), array()) in helpers.php line 856
5.  at view('index') in Portofolio.php line 56
6.  at Portofolio->link()
7.  at call_user_func_array(array(object(Portofolio), 'link'), array()) in Controller.php line 55

In line 2 of the error message, you can see that it's still in the local directory. I have tried using

php artisan config:clear|cache
php artisan view:clear
php artisan route:cache
php artisan optimize

and not even one has solved the problem. here is the view section in the config file after php artisan config:cache and as you can see its already using the VPS directory

'view' => 
  array (
    'paths' => 
    array (
      0 => '/home/wahyuhan/portofolio/resources/views',
    ),
    'compiled' => '/home/wahyuhan/portofolio/storage/framework/views',
  ),

Maybe the problem is in my route or controller page but I cant seems to find the problem there. The server OS is CentOS and I already read that CentOS is case-sensitive but I don't see any case sensitive problem in here.

Here is my server directory

Root
|-- portofolio
    |-- app
    |-- bootstrap
    |-- config
    |-- database
    |-- resources
        |-- assets
        |-- lang
        |-- views
            |-- index.blade.php
    |-- routes
    |-- storage
    |-- tests
    |-- vendor
|-- public_html
    |-- css
    |-- img
    |-- js
    |-- vendor

Here is my ROUTE

Route::get('/', ['as' => 'home', 'uses' => 'Portofolio@link']);

Here is my CONTROLLER

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class Portofolio extends Controller
{
    public function link() {

        $categories = [
            '1' => 'Print Design',
            '2' => 'Logo Design',
            '3' => 'Web Design',
            '4' => 'Product Design',
            '5' => 'Character Design',
            '6' => 'Packaging Design'
        ];

        $projects = [
            '1' => 'IMSAA Training Certificate',
            '2' => 'Rusticity Logo',
            '3' => 'Handy Production Website',
            '4' => 'Nihon no Matsuri Bag Project',
            '5' => 'The Chin - Captain Jack Sparrow',
            '6' => 'Rusticity Packaging'
        ];

        $images = [
            '1' => '1',
            '2' => '2',
            '3' => '3',
            '4' => '4',
            '5' => '5',
            '6' => '6'
        ];

        $skills = [
            '1' => 'Photoshop',
            '2' => 'Ms. Office',
            '3' => 'Laravel',
            '4' => 'PHP',
            '5' => 'HTML',
            '6' => 'MySQL'
        ];

        $points = [
            '1' => '80%',
            '2' => '90%',
            '3' => '60%',
            '4' => '60%',
            '5' => '60%',
            '6' => '60%'
        ];

        return view('index')->withCategories($categories)->withProjects($projects)->withImages($images)->withSkills($skills)->withPoints($points);
    }
}

any advice?


Solution

  • The problem is that my server is not setting up properly because the domain doesnt connected properly to my VPS. Contacted the hosting provider and the problem solved.

    If anyone have this problem just check

    1. Have you already doing php artisan config:cache or php artisan config:clear?
    2. Did you name your view correctly with yourview.blade.php?
    3. Did you place the view correctly in the resources\views?