【问题标题】:MethodNotAllowedHttpException using inertiaMethodNotAllowedHttpException 使用惯性
【发布时间】:2021-02-13 02:06:37
【问题描述】:

我正在使用InertiaLaravel。我在web.php 注册了路线。当我向服务器发送数据时,我收到错误 405,它告诉我 MethodNotAllowedHttpExceptionthe PUT methods is not allowed for this route 但数据库中的数据已成功更新;

in question componet.vue

update(){
   this.$inertia.put(`questions/${this.id}`, this.question, {
        onSuccess: () => {
            //do some stuffs
          })
   }

in QuestionsController.php

 public function update(AskQuestionRequest $request, Question $question)
    {
        
        $question->update($request->only(['title', 'body']));
        return redirect()->back()->with('successMsg', 'Your Question has been updated successfully');
    }

【问题讨论】:

    标签: vue.js laravel-8 inertiajs


    【解决方案1】:

    这通常发生在您的应用中尚未安装 Inertia 中间件时。如果您最近将inertiajs/inertia-laravel 软件包升级到0.3.x,则需要按照升级说明here 在您的应用中安装中间件。

    【讨论】:

      猜你喜欢
      • 2019-04-20
      • 1970-01-01
      • 2017-08-13
      • 1970-01-01
      • 1970-01-01
      • 2012-08-18
      • 2022-06-11
      • 2018-01-08
      • 1970-01-01
      相关资源
      最近更新 更多