douju7765 2018-11-07 14:50
浏览 292
已采纳

Laravel:Symfony \ Component \ HttpKernel \ Exception \ MethodNotAllowedHttpException没有消息

Please help. I cannot create new object. This is the form where the painting will be created. When I open the website it says MethodNotAllowedHttpException and have no message.

In web.php (route)

Route::post('store','PaintingController@store');

In controller

        $last_line = DB::table('art_objs')->orderBy('Id_no', 'DESC')->first();
        $last = $last_line->Id_no;

        $art_objs = new Art_obj(
            ['Artist' => $request->get('Artist'),
            'Year' => $request->get('Year'),
            'Title' => $request->get('Title'),
            'Description' => $request->get('Description'),
            'Origin' => $request->get('Origin'),
            'Epoch' => $request->get('Epoch'),
            'Type_of_art'=>'1',
            'Type_of_coll'=>$request->input('Type_Coll'),
        ]);
        $art_objs->save();

In blade

<form method="post" action="store">  {{csrf_field()}} 
                <div class="form-group">
                    <label> Title: </label> <input type="text" name="Title" class="form-control" placeholder="Title"/> 
                </div>
                <div class="form-group">
                    <label> Artist: </label> <input type="text" name="Artist" class="form-control" placeholder="Artist" /> 
                </div>
                <div class="form-group">
                    <label> Year: </label> <input type="text" name="Year" class="form-control" placeholder="Year"/> 
                </div>
                <div class="form-group">
                    <label> Origin: </label> <input type="text" name="Origin" class="form-control" placeholder="Origin"/> 
                </div>
                <div class="form-group">
                    <label> Epoch: </label> <input type="text" name="Epoch" class="form-control" placeholder="Epoch"/> 
                </div>
                <div class="form-group">
                    <label> Description: </label> <textarea name="Description" class="form-control" rows="5" placeholder="description"></textarea> 
                </div>
                <div class="form-group">
                <label> Paint type: </label><input type="text" name="Paint_type" class="form-control" placeholder="Paint type"/> 
                </div>
                <div class="form-group">
                <label> Drawn on: </label><input type="text" name="Drawn_on" class="form-control" placeholder="Drawn on" /> 
                </div>
                <div class="form-group">
                <label> Style: </label><input type="text" name="Style" class="form-control" placeholder="Style"/> 
                <div class="form-group"> 
                    <input type="submit" class="btn btn-primary" value="CREATE" /> 
                </div>
                <input type="hidden" name="_method" value="PATCH" /> 
            </form>

enter image description here

  • 写回答

3条回答 默认 最新

  • dongyong3554 2018-11-07 15:05
    关注

    Remove the following from your form:

    <input type="hidden" name="_method" value="PATCH" />
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度
  • ¥30 关于#r语言#的问题:如何对R语言中mfgarch包中构建的garch-midas模型进行样本内长期波动率预测和样本外长期波动率预测
  • ¥15 ETLCloud 处理json多层级问题
  • ¥15 matlab中使用gurobi时报错
  • ¥15 这个主板怎么能扩出一两个sata口
  • ¥15 不是,这到底错哪儿了😭
  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么