找不到Laravel 4模型类别 [英] Laravel 4 Model class not found
本文介绍了找不到Laravel 4模型类别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我刚刚在Laravel 4中创建了一个简单的应用程序,当我创建模型时,出现了一个未找到的异常.
I just created a simple app in Laravel 4 and when I create a model, I get an exception that it's not found.
// /app/models/Worker.php:
<?php
class Worker extends Eloquent {}
然后在控制器中
var_dump(Worker::find(1));
这给了我错误:找不到类'Worker'.我究竟做错了什么?这曾经在Laravel 3中起作用,并且还观看了似乎应该起作用的截屏视频.
This gives me Error: Class 'Worker' not found. What am I doing wrong? This used to work in Laravel 3 and also watching the screencasts it seems like this should work.
推荐答案
每次在L4中创建新的类文件时,请运行此命令.
Anytime you create a new class file in L4 run this command.
php composer dump-autoload
这篇关于找不到Laravel 4模型类别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文