有关返回上一页数据的线索

时间:2018-10-17 03:35:52

标签: laravel laravel-5.5

我正在实现一个有趣的页面,它与销售有关,就是这个。

enter image description here

这是一项账单,您可以更改三个字段,并使用“ Guardar venta”按钮保存更改。我正在使用create方法这样做,因为实际上账单不存在,但是我必须添加项目(加号),问题是我认为,添加项目后必须返回此视图并显示该项目添加,但是,由于它是创建的(正如我告诉我的那样,这就是我认为的工作方式),所以添加未显示,并且对这三个字段的所有修改都消失了。

enter image description here

什么都没显示

enter image description here

这是我的notas(票据)控制器上的create方法

public function create()
{
    //
    $lockers = null;
    $lockers = Locker::all();

    $eventos = null;
    $eventos = Evento::all();


    $cajaAbierta = Caja::whereRaw('dtmCorte IS NULL')->get()->first();

    $currentTime = Carbon::now('-5:00');

    $cargos = null;


    $productos = ProductoServicioEvento::all();

    $usuarios = Usuario::all();



    if($cajaAbierta)
    {

        $nota = Nota::create(
            [
                'idCaja'=>$cajaAbierta->idCaja,
                'idRealiza'=>$cajaAbierta->idUsuario,
                'dtmHoraCargo'=>$currentTime,
            ]
        );



        if($nota)
        {

            $cargos = Cargo::where('idNota', $nota->idNota);
//                return redirect()->route('grupos.index')->with('success','Grupo creado con éxito');
            return view('notas.create',['lockers'=>$lockers,'eventos'=>$eventos,'nota'=>$nota, 'cargos'=>$cargos,'productos'=>$productos,'usuarios'=>$usuarios]);
        }

    }

模态窗口中+号之后,这是我的货物(物品)控制器。

public function store(Request $request)
{
    //
    $idNota = $request->input('idNota');
    $idProducto = $request->input('idProducto');
    $fltCantidad = $request->input('fltCantidad');
    $dcmPrecio = $request->input('dcmPrecio');
    $sItDescuento = $request->input('sItDescuento');
    $dcmImporte = $request->input('dcmImporte');
    $dcmSaldo = $request->input('dcmSaldo');

    $bolMensual = 0;
    if ( $request->has('bolMensual')) 
    {

        $bolMensual = $request->input('bolMensual');


    }

            $cargo = Cargo::create(
            ['idNota'=>$idNota,
                'idProductoServicioEvento'=>$idProducto,
                'dcmPrecio'=>$dcmPrecio,
                'dcmImporte'=>$dcmImporte,
                'sItDescuento'=>$sItDescuento,
                'fltCantidad'=>$fltCantidad,
                'dcmSaldo'=>$dcmSaldo
            ]

        );

        //dd($cargo);

        if($cargo)
        {


            return back()->withInput()->with('success','La partida se creó correctamente');
        }


}

很明显我做错了什么,但这是我知道返回的唯一方法,问题是我在做类似创建,更新,显示混合的事情...

谢谢。

0 个答案:

没有答案
相关问题