我收到Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException

时间:2014-09-23 14:09:48

标签: php symfony controller routes

我目前正在尝试在我的主页上添加一个表单,用户可以在其中发表评论,然后在下面输入该表单的输出,以便访问者可以看到所有消息。
当我提交评论时,我目前收到以下错误:

Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException

这是控制器:

 <?php

use Desk\Forms\MessageForm; 
use Desk\Records\MessageRecord;
use Desk\Repositories\MessageRepository;

class MessageController extends BaseController
{

protected $messageForm;

public function __construct(MessageForm $messageForm, MessageRepository $messageRepository,
  MessageRecord $messageRecord)
{
    $this->messageForm = $messageForm;
    $this->messageRepository = $messageRepository;
    $this->messageRecord = $messageRecord;
}

/**
 * Display a listing of the resource.
 * GET /messages
 *
 * @return Response
 */
public function create()
{
    return View::make('comments.create');
}



public function show($comment)
{
    $message_id = $this->messageRepository->find($comment);
    return View::make('comments.show')->with('comment', $message_id);
}

/**
 * Store a newly created resource in storage.
 * POST /messaages
 *
 * @return Response
 */
public function store()
{
    $data = Input::all() ;
    $this->messageForm->validate($data);

    $messageRecord = new MessageRecord;
    $messageRecord->comment = $data['comment'];

    Return "Comment created";
}
}

这是路线:

Route::resource('/message', 'MessageController');

0 个答案:

没有答案