I am getting Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException

好久不见. 提交于 2019-12-13 04:46:11

问题


I am currently trying to include a form onto my homepage where the user can leave a comment and then include the output of that form below so visitors can see all the messages.
I am currently getting the following error when i submit a comment:

Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException

Here is the controller:

 <?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";
}
}

Here is the route:

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

来源:https://stackoverflow.com/questions/25997303/i-am-getting-symfony-component-httpkernel-exception-methodnotallowedhttp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!