2017-02-21 36 views
0

我曾經遇到過一個問題,以路由:Laravel-5.3:錯誤:查看[主]沒有找到

ErrorException in FileViewFinder.php line 137: 
View [main] not found. (View: C:\xampp\htdocs\store\resources\views\currencies\index.blade.php) 

而且

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

我不知道爲什麼我收到此錯誤。

我所試圖做的事:

我的路線:

Route::resource('currencies', 'CurrencyController'); 

控制器:

public function index() 
{ 
    // create a variable and store all the posts in it from the database 
    $currencies = Currency::orderBy('id', 'asc')->paginate(5); 
    //$currencies = Currency::all(); 

    // return a view and pass in the above variable 
    return view('currencies.index')->withCurrencies($currencies); 
} 

而且我認爲(資源/視圖/貨幣/ index.blade。 php):

@extends('main') 

@section('title', '| Settings - Currencies') 

@section('content') 

@endsection 

任何人都可以帶我去正確的方向嗎? 在此先感謝!

回答

1

您正試圖顯示一個頁面,其視圖爲main.blade.php作爲頁面的佈局。這就是@extends('main')所做的。

看來文件main.blade.php不存在於您的視圖根目錄中。創建此文件或編輯此視圖中的鏈接。

+0

我知道我有一個愚蠢的錯誤,我有一個頁面名爲index.blade.php我的佈局頁面,但我沒有改變擴展文件名爲@extends('索引')...感謝哥們! –

+0

沒問題,很樂意幫忙。如果這解決了問題,請考慮將此答案標記爲解決方案。 :) – Jerodev