Liv*_*ire 5 php laravel blade laravel-5 homestead
这似乎是一个在Laravel内不时出现的问题.我正在编写一个CRUD控制器,以便继续使用它,但是在测试时我得到了InvalidArgumentException in FileViewFinder.php line 137: View [bookingcrud.index] not found错误.这是我的代码:
routes.php文件:
Route::resource('bookingcrud', 'BookingsCrudController');
Run Code Online (Sandbox Code Playgroud)
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);
}
}
Run Code Online (Sandbox Code Playgroud)
并且位于~/laravel/resources/views/bookingcrud/index.blade.php
此视图文件中的视图无论是来自工作视图的标记还是仅仅是单词"cheese"我将始终得到:
InvalidArgumentException in FileViewFinder.php line 140:
View [bookingcrud.index] not found.
Run Code Online (Sandbox Code Playgroud)
我在一个已知的工作控制器中测试了相同的视图并得到了相同的错误但是我在同一个CRUD控制器上测试了一个已知的工作视图并且它工作正常.我也尝试更改视图的目录并重命名它,但我会得到相同的错误,"View [bookingcrud.index]"正确更改.我确保文件和目录的权限已满,以便进行测试.
自从第一次收到错误后,我已经从5.0.26升级到5.1.1(这是我发现错误的版本)并运行了作曲家更新.另外,从查看具有相同错误的线程,我也运行了artisan config:clear
我正在使用Virtual Box部署的Homestead 2.0.17在Windows 8.1上进行开发.
在这一点上,任何帮助都会非常有用,它正在努力.
小智 14
请使用终端
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
Run Code Online (Sandbox Code Playgroud)
抱歉我的英文
事实证明我拼错了刀片,然后用第二双眼睛注意到它.
$ ls resources/views/crud/booking/
crud.balde.php index.balde.php
Run Code Online (Sandbox Code Playgroud)
绝对是一个教训,总是在调试时仔细检查小东西.谢谢您的帮助.
| 归档时间: |
|
| 查看次数: |
18093 次 |
| 最近记录: |