app/Http/Controllers/PhieuBaoHanhController.php
/**
     * Store a newly created resource in storage.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return \Illuminate\Http\Response
     */
Store a newly created resource in storage.
Store a newly created resource in storage .
public function store(Request $request)
    {
        $isExist =   DB::table('phieu_bao_hanhs')
            ->where('serial','=',$request->serial)->get();
        if($isExist):
            return back()
                ->with('errors','Đã tồn tại số serial này');
        endif;
        $pbh = new phieuBaoHanh();
        $pbh->id_chitietdonhang = $request->id_chitietdonhang;
        $pbh->id_sanpham = $request->id_sanpham;
        $pbh->serial = $request->serial;
        $pbh->save();
        return back()
            ->with('success','Lập phiếu thành công');
    }
public function store ( Request $ request ) { $ isExist = DB :: table ( 'phieu_bao_hanhs' ) -> where ( 'serial' , '=' , $ request -> serial ) -> get ( ) ; if ( $ isExist ) : return back ( ) -> with ( 'errors' , 'Đã tồn tại số serial này'); endif ; $ pbh = new phieuBaoHanh ( ) ; $ pbh -> id_chitietdonhang = $ request -> id_chitietdonhang ; $ pbh -> id_sanpham = $ request -> id_sanpham ; $ pbh -> serial = $ request -> serial ; $ pbh -> save ( ) ; return back ( ) -> with ( 'success' , 'Lập phiếu thành công'); }
Store a newly created resource in storage.
Store a newly created resource in storage .
//