Laravel 5.1 未找到视图

Laravel 5.1 View not found

这似乎是 Laravel 中不时出现的问题。我正在编写一个 CRUD 控制器以配合它,但是在测试时我得到了 InvalidArgumentException in FileViewFinder.php line 137: View [bookingcrud.index] not found 错误。这是我的代码:

routes.php:

Route::resource('bookingcrud', 'BookingsCrudController');

BookingsCrudController.php

use uasc\Http\Requests;
use uasc\Http\Requests\CrudCreateRequest;
use uasc\Http\Requests\CrudUpdateRequest;
use uasc\Http\Controllers\Controller;

use Auth;
use DB;
use Illuminate\Pagination\Paginator;

use Illuminate\Http\Request;

class BookingsCrudController extends Controller {

    public function index()
    {
        if (!Auth::check() || Auth::user()->authority < 1) {
            return redirect('/login');
        }

        $raw = "select * from bookings";
        $bookings = DB::select($raw);
        $paginatedBookings = new Paginator($bookings, 1);

        return view('bookingcrud.index')->with('bookings', $paginatedBookings);
    }
}

并且视图位于 ~/laravel/resources/views/bookingcrud/index.blade.php 无论这个视图文件中有什么,无论是来自工作视图的标记还是只是 "cheese" 这个词,我总是会得到:

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

我在一个已知的工作控制器上测试了相同的视图并得到了同样的错误但是我在同一个 CRUD 控制器上测试了一个已知的工作视图并且它工作了。我也尝试过更改视图的目录并重命名它,但是如果 "View [bookingcrud.index]" 适当更改,我会得到同样的错误。我确保文件和目录的权限已满以进行测试。

自从第一次收到错误后,我已经从 5.0.26 升级到 5.1.1(这是我的错误源版本)和 运行 作曲家更新。同样通过查看具有相同错误的线程,我也有 运行 artisan config:clear

我正在 Windows 8.1 上开发,Homestead 2.0.17 部署了 Virtual Box。

在这一点上,任何帮助都会非常有用,它正在努力。

原来是我拼错了 blade,不过又换了一双眼睛才注意到。

$ ls resources/views/crud/booking/
crud.balde.php  index.balde.php

绝对是一个教训,在调试时总是仔细检查小事情。 感谢您的帮助。

请使用终端

homestead ssh > Press Enter
vagrant@homestead cd /Path_of_Your_Project/
vagrant@homestead:~/Path_of_Your_project php artisan cache:clear
vagrant@homestead:~/Path_of_Your_project php artisan config:cache

抱歉我的英语不好

请记住 Linux 区分大小写!

我有这样的事情:

return view('MyView', $data);

它在我的环境中工作 (Mac OS),但在部署服务器 (Ubuntu) 中没有工作!

对于没有 SSH 访问权限的人,有两种方法可以解决此问题。

如果您没有任何默认 Laravel 包的插件, 首先,只需删除 bootstrap/cache/config.php 即可解决文件,

如果您有任何默认 Laravel 包的插件, 将提到的所有相关路径 bootstrap/cache/config.php 更改为分配 laravel 项目的确切路径。