title: 405 (Method Not Allowed) Laravel
body: <p>I am getting a 405 (Method Not Allowed) in Laravel while trying to delete an item using ajax. Someone please help.</p>
  
  <p>Here is my route </p>
  
  <pre><code>Route::get('/home', 'HomeController@index')-&gt;name('home');
  Route::post('/destroy', 'PagesController@destroy');
  Auth::routes();
  </code></pre>
  
  <p>Here is my ajax code </p>
  
  <pre><code>        function confirmDelete(id){
          //alert('Delete post id-'+id);
          $.ajax({
              type: 'post',
              url: 'blogs/destroy',
              data: {'id' : id},
              dataType: 'json',
              cache: false,
              success: function(res){
                  console.log("worked");
                      alert(res);
              }
          })
      }
  </code></pre>
  
  <p>Here is my controller</p>
  
  <pre><code>public function destroy (Request $request){
      $id = $request-&gt;id;
      echo json_encode ($id);
  //        $blog = Blog::findorFail ( $id );
  //        $blog-&gt;delete ();
  //        return response(['msg'=&gt;'Post deleted', 
  'status'=&gt;'success']);
  //        return redirect::to ( '/blogs' )-&gt;with ( 'success', 'Post 
  successfully deleted!' );
  }
  </code></pre>