dream543211 2017-01-14 16:45
浏览 499
已采纳

Laravel 5.3 - InvalidArgumentException未找到视图[索引]

UPDATE END: I have solved the problem

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. I think the error can be in my routes or maybe controller because the path is still going into my local machine directory (see error message line 2) but I really can't see the problem in the code.

I have tried using php artisan config:cache, php artisan cache:clear, php artisan route:cache but it still doesnt work. It still refer to my local machine directory.

This is the directory of the index.blade.php

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

This is the Route

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

This is the 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);
}
}

This is the error message (see line 2)

InvalidArgumentException in FileViewFinder.php line 137:

View [index] not found.

1.  in FileViewFinder.php line 137
2.  at FileViewFinder->findInPaths('index', array('E:\Laravel\portofolioesources\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
8.  at Controller->callAction('link', array()) in ControllerDispatcher.php line 44
9.  at ControllerDispatcher->dispatch(object(Route), object(Portofolio), 'link') in Route.php line 190
10. at Route->runController() in Route.php line 144
11. at Route->run(object(Request)) in Router.php line 653
12. at Router->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 53
13. at Pipeline->Illuminate\Routing\{closure}(object(Request)) in SubstituteBindings.php line 41
14. at SubstituteBindings->handle(object(Request), object(Closure)) in Pipeline.php line 137
15. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
16. at Pipeline->Illuminate\Routing\{closure}(object(Request)) in VerifyCsrfToken.php line 65
17. at VerifyCsrfToken->handle(object(Request), object(Closure)) in Pipeline.php line 137
18. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
19. at Pipeline->Illuminate\Routing\{closure}(object(Request)) in ShareErrorsFromSession.php line 49
20. at ShareErrorsFromSession->handle(object(Request), object(Closure)) in Pipeline.php line 137
21. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
22. at Pipeline->Illuminate\Routing\{closure}(object(Request)) in StartSession.php line 64
23. at StartSession->handle(object(Request), object(Closure)) in Pipeline.php line 137
24. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
25. at Pipeline->Illuminate\Routing\{closure}(object(Request)) in AddQueuedCookiesToResponse.php line 37
26. at AddQueuedCookiesToResponse->handle(object(Request), object(Closure)) in Pipeline.php line 137
27. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
28. at Pipeline->Illuminate\Routing\{closure}(object(Request)) in EncryptCookies.php line 59
29. at EncryptCookies->handle(object(Request), object(Closure)) in Pipeline.php line 137
30. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
31. at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104
32. at Pipeline->then(object(Closure)) in Router.php line 655
33. at Router->runRouteWithinStack(object(Route), object(Request)) in Router.php line 629
34. at Router->dispatchToRoute(object(Request)) in Router.php line 607
35. at Router->dispatch(object(Request)) in Kernel.php line 268
36. at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) in Pipeline.php line 53
37. at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 46
38. at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 137
39. at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
40. at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104
41. at Pipeline->then(object(Closure)) in Kernel.php line 150
42. at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 117
43. at Kernel->handle(object(Request)) in index.php line 54
  • 写回答

2条回答 默认 最新

  • duan00529 2017-01-16 04:35
    关注

    I have solved the problem

    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?
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?
  • ¥15 c++头文件不能识别CDialog