exception: "Symfony\Component\HttpKernel\Exception\NotFoundHttpException",…} - Hack The Tech - Latest News related to Computer and Technology

Hack The Tech - Latest News related to Computer and Technology

Get Daily Latest News related to Computer and Technology and hack the world.

Saturday, November 20, 2021

exception: "Symfony\Component\HttpKernel\Exception\NotFoundHttpException",…}

I have this script in my php model:

private function getAcciones() : array
{
    $base_url = url(config('backpack.base.route_prefix'));
    $todas_las_acciones = [
        [
            'condition' => $this->isDeletable(),
            'action'    => '
                            <script type="text/javascript">
                                   function deleteComplementoPago( id ){
                                       Swal.fire({
                                            title: \'¿Esta segura/o de eliminar este complemento de pago?\',
                                            type: \'warning\',
                                            showCancelButton: true,
                                            confirmButtonColor: \'#3085d6\',
                                            cancelButtonColor: \'#d33\',
                                            confirmButtonText: \'Si, confirmar\',
                                            showLoaderOnConfirm: true,
                                            
                                            }).then((result) => {
                                                if( result.value ){
                                                    $.ajax({
                                                    type: "POST",
                                                    url: "/webapi/finanzas/complemento/pago/" + id + "/delete",
                                                    data: { pago_id: id },
                                                    success: function(data){
                                                        console.log(data)
                                                        window.location.replace("' . $base_url . '/finanzas/complemento/pago");
                                                    }
                                                    })                                          
                                                }
                                            });
                                   }
                            </script>
                            <li><a onclick="deleteComplementoPago(\''.$this->id.'\')"><i class="fa fa-times"></i> Borrar </a></li>'
        ]
    ];

    $result = [];

    foreach ($todas_las_acciones as $accion){
        if($accion['condition']){
            $result[] = $accion['action'];
        }
    }

    return $result;
}

And I have this in my web.php

Route::get('finanzas/complemento/pago/{pago}/delete', 'PagoCrudController@deletePago');

I just want to make the swal.fire to appear and ask the customer if he/she really wants to delete the item, however im getting this error:

{message: "", exception: "Symfony\Component\HttpKernel\Exception\NotFoundHttpException",…} exception: "Symfony\Component\HttpKernel\Exception\NotFoundHttpException" file: "/Users/rodri6uez/Documents/LARAVEL/HIPO/vendor/laravel/framework/src/Illuminate/Routing/RouteCollection.php" line: 179 message: "" trace: [{,…}, {,…}, {,…}, {,…}, {,…},…]

This is what I have on my controller:

public function deletePago(Pago $pago){
    try{
        \DB::beginTransaction();
        $pagos_factura = $pago->pago_facturas()->get();
        foreach ($pagos_factura as $pago_factura){
            $abono = Abono::withTrashed()->where('origen_id', $pago_factura->id)
                ->where('tipo', 'Complemento pago')
                ->first();
            if( isset($abono) ) $this->borrar_abono($abono);
            $pago_factura->delete();
        }

        $pago->delete();
        \DB::commit();
        \Alert::success(trans("Complemento de pago borrado con exito"))->flash();
        return redirect('admin/finanzas/complemento/pago');
    }catch (\Exception $e){
        \DB::rollBack();
        \Alert::error(trans($e->getMessage()))->flash();
        return redirect('admin/finanzas/complemento/pago');
    }
}

Could you help me please? I cannot see what my error is.



source https://stackoverflow.com/questions/70039897/exception-symfony-component-httpkernel-exception-notfoundhttpexception

No comments:

Post a Comment