[英]Namespacing not working in Laravel
Hello I do have a Model called 'Event' 您好,我有一个名为“事件”的模型
/app/models/DC/Events/Event.php /app/models/DC/Events/Event.php
<?php
namespace models\DC\Events;
class Event extends \Eloquent {
protected $table = 'Events';
protected $guarded = array('id', 'password_confirmation');
protected $fillable = [
'name',
'adress',
'zipcode',
'time',
'date',
'Fee',
'link',
'Description',
'country',
'city',
'fblink',
'lineup'
];
}
/app/controllers/EventController.php /app/controllers/EventController.php
<?php
use \models\DC\Events\Event as S;
class EventController extends \BaseController {
/**
* Display a listing of the resource.
* GET /events
*
* @return Response
*/
public function index()
{
$events = S::all();
$events = S::paginate(5);
return View::make('events.index');
}
}
But it tells me "Class 'models\\DC\\Events\\Event' not found" 但这告诉我“找不到类'models \\ DC \\ Events \\ Event'”
Any suggestions on solving or is there be a better approach? 关于解决的任何建议还是有更好的方法?
为了更新autload文件以确保所有类都包含在内,您需要运行
composer dump-autoload
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.