app/Http/Controllers/CheckoutController.php
/**
     * Show the form for editing the specified resource.
     *
     * @param  string $id
     * @return \Illuminate\Http\Response
     */
Show the form for editing the specified resource.
@param  string $id
@return \Illuminate\Http\Response
Show the form for editing the specified resource . @param string $id @return \ Illuminate \ Http \ Response
public function xuatHoaDon($id)
    {
        $donhang = DB::table('don_dat_hangs')
            ->where('madonhang','=',$id)->first();
        if($donhang->trangthai == "Chờ Xử Lý"):
            $donhang->trangthai = "Đang Xử Lý";
            $donhang->save();
        endif;
        $ctdhs = DB::table('chi_tiet_don_dat_hangs')
            ->join('san_phams', 'san_phams.id', '=', 'chi_tiet_don_dat_hangs.id_sanpham')
            ->select('chi_tiet_don_dat_hangs.*','san_phams.*')
            ->where('id_donhang', $donhang->madonhang)->get();
        $result = json_decode($ctdhs, true);
        echo "<pre>"; print_r($result); exit();
        return view('admin.donHang.hoadon')
            ->with('donhang',$donhang)
            ->with('ctdhs',$result);
    }
public function xuatHoaDon ( $ id ) { $ donhang = DB :: table ( 'don_dat_hangs' ) -> where ( 'madonhang' , '=' , $ id ) -> first ( ) ; if ( $ donhang -> trangthai == " Chờ Xử Lý"): $ donhang -> trangthai = " Đang Xử Lý"; $ donhang -> save ( ) ; endif ; $ ctdhs = DB :: table ( 'chi_tiet_don_dat_hangs' ) -> join ( 'san_phams' , 'san_phams.id' , '=' , 'chi_tiet_don_dat_hangs.id_sanpham' ) -> select ( 'chi_tiet_don_dat_hangs.*' , 'san_phams.*' ) -> where ( 'id_donhang' , $ donhang -> madonhang ) -> get ( ) ; $ result = json_decode ( $ ctdhs , true ) ; return view ( 'admin.donHang.hoadon' ) -> with ( 'donhang' , $ donhang ) -> with ( 'ctdhs' , $ result ) ; }
Show the form for editing the specified resource.
Show the form for editing the specified resource .
// //echo "<pre>"; print_r($result); exit();