Problem with delete after deploy

0
Good afternoon. I deployed an APP that I'm developing in Laravel with PHP 7, in order to generate orders. The application is very simple, it has:

  • a customer registration and consultation;
  • Products query;
  • Order manager (register / consult / edit / delete);

Running the project on my machine, all methods (get / post / delete) are running normally, but after deploy the 'DELETE' methods of my 'order items' are not working.

The delete functions are not appearing in my log, and I also can not inspect the error. Has anyone had this problem? Thanks

Delete Route:

Route::delete('painel/pedidos/removeitem', 'Painel\pedidosController@removeItem');

Delete function:

//****************************************************************************
public static function removeItem(Request $request) {
//****************************************************************************
    $id_pedido  = $request->id_pedido;
    $id_produto = $request->id_produto;
    $tamanho    = $request->tamanho;
    $tot_item   = $request->tot_item; 
    try{
        $observacao = "EXCLUINDO NORMALMENTE";
        // pega o valor deste registro
        $total = PedidosItens::where( 'ID_PEDIDO' , $id_pedido  )
                                                 ->where( 'ID_PRODUTO', $id_produto )
                                                 ->where( 'TAMANHO'   , $tamanho    )
                                                 ->value( 'PRECO_TOTAL' );

        // procura pelo item e deleta
        $item = PedidosItens::where( 'ID_PEDIDO' , $id_pedido  )
                                                ->where( 'ID_PRODUTO', $id_produto )
                                                ->where( 'TAMANHO'   , $tamanho    )
                                                ->delete();


        //se remover SUBTRAI NO TOTAL DO PEDIDO
        $total_ped        = Pedidos::findOrFail($id_pedido);
        $total_ped->TOTAL = ( $total_ped->TOTAL - $total) ;
        $total_ped->save();

        return response( ['STATUS' => 'OK', "OBSERVACAO" => $observacao , "TOT_ITEM" => $total , "TOTAL_PEDIDO" => $total_ped->TOTAL] );

    } catch ( Exception $e ) {

        return response( ['STATUS' => 'ERRO', 'ERRO' => $e->getMessage()] );
    }
}

javascript function:

//****************************************************************************
$("#tabela_itens").on('click', '.btn_exclui_prod' , function() {
//EXCLUI ITEM DO PEDIDO EM MODO GRID
//****************************************************************************

    var row        = $(this).closest('tr');
    var sender     = $(this).closest('button');
    var id_produto = sender.data('idprod');
    var id_pedido  = sender.data('idped' );
    var tamanho    = sender.data('tam'   );

    var formURL    = '/painel/pedidos/removeitem';

    if(!modoGrade){
        var dados      = '{  "id_produto": "' + id_produto + '",' +
                        '"id_pedido": '  + id_pedido  + ',' +
                        '"tamanho": "'   + tamanho    + '" }';
    } 

    var jsonobj = JSON.parse(dados);                                                                                        

    Pace.track( function(){

        $.ajax({ url      : formURL,
                 type     : 'DELETE' ,
                 data     : jsonobj  ,
                 dataType : 'json',

                 success : function(data) {                                                                                 

                    if (data.STATUS == 'OK') {

                        row.fadeOut('1000', function() {
                            row.remove();
                            });

                            $("#total_pedido").val( '' );
                            $("#total_pedido").val("R$ " + data.TOTAL_PEDIDO.toFixed(2) );

                            console.log(data.STATUS);

                        }

                 },

                 error : function(data) {
                         console.log(data);
                         console.log(data.OBSERVACAO);
                         console.log(data.STATUS);
                         console.log("ERRO AO DELETAR ITEM");
                 }

        });

    });

}); // FIM -> $("#tabela_itens").on('click', '.btn_exclui_prod' , function() {
// FIM DE EXCLUSÃO DE ITENS EM MODO GRID
//****************************************************************************
    
asked by anonymous 09.06.2017 / 20:41

0 answers