Model view controller 未正确找到Laravel 4模型类函数
我正在使用Laravel4框架开发一个事件管理器,并在Model view controller 未正确找到Laravel 4模型类函数,model-view-controller,laravel,laravel-4,Model View Controller,Laravel,Laravel 4,我正在使用Laravel4框架开发一个事件管理器,并在/app/models/event.php中创建了一个新模型。在这个文件中,我使用了方法public function postCreateEvent($eventDetails)。我收到错误,调用未定义的方法illumed\Events\Dispatcher::postCreateEvent()。有人能帮我确定为什么Laravel 4在模型中找不到函数吗 /app/controllers/Events/controllers/Manager
/app/models/event.php
中创建了一个新模型。在这个文件中,我使用了方法public function postCreateEvent($eventDetails)
。我收到错误,调用未定义的方法illumed\Events\Dispatcher::postCreateEvent()
。有人能帮我确定为什么Laravel 4在模型中找不到函数吗
/app/controllers/Events/controllers/Manager/ManagerController.php是:
<?php
namespace Events\Controllers\Manager;
use \View, \BaseController, \Site, \Event, \Input;
class ManagerController extends BaseController
{
//This control ensures the user is logged in before they can view any of the manager pages or use the manager actions
public function __construct()
{
$this->beforeFilter('auth');
}
//This control gets the correct manager page and displays it
public function getManager($nav = null)
{
if ($nav == null)
{
return View::make('manager');
}
else
{
return View::make('manager/'.$nav);
}
}
//This control takes the site settings page when it is POSTed and moves it to the model to update the site settings.
public function postSiteSettings()
{
$siteSettings = array(
'siteTitle' => Input::get('siteTitle'),
'siteAddress' => Input::get('siteAddress'),
'adminEmail' => Input::get('adminEmail'),
'openRegistrations' => Input::get('openRegistrations')
);
Site::postSiteSettings($siteSettings);
return View::make('manager/settings');
}
public function postCreateEvent()
{
$eventDetails = array(
'eventCalendar' => Input::get('siteTitle'),
'eventName' => Input::get('eventName'),
'eventDescription' => Input::get('eventDescription'),
'eventCapacity' => Input::get('eventCapacity'),
'eventRegistrationType' => Input::get('eventRegistrationType'),
'eventLocationName' => Input::get('eventLocationName'),
'eventLocationAddress1' => Input::get('eventLocationAddress1'),
'eventLocationAddress2' => Input::get('eventLocationAddress2'),
'eventLocationAddress3' => Input::get('eventLocationAddress3'),
'eventLocationCity' => Input::get('eventLocationCity'),
'eventLocationState' => Input::get('eventLocationState'),
'eventLocationZIP' => Input::get('eventLocationZIP'),
'eventLocationCountry' => Input::get('eventLocationCountry'),
'eventLocationPhone' => Input::get('eventLocationPhone'),
'eventStartDate' => Input::get('eventStartDate'),
'eventEndDate' => Input::get('eventEndDate'),
'eventStartTime' => Input::get('eventStartTime'),
'eventEndTime' => Input::get('eventEndTime'),
'eventRSVPEndDate' => Input::get('eventRSVPEndDate'),
'eventPublishDate' => Input::get('eventPublishDate'),
'eventArchiveDate' => Input::get('eventArchiveDate')
);
$event = new Event;
if (Event::postCreateEvent($eventDetails))
{
return View::make('manager/createEvent');
}
else
{
echo "WTF....";
}
}
}
该类已经存在于框架中,这就是您在中调用的
Event::postCreateEvent($eventDetails)
因此,它尝试在框架的Event
类上调用postreateevent
方法,但该方法不存在
如果有帮助,请尝试将类名更改为其他名称
Event::postCreateEvent($eventDetails)