app/Http/Controllers/BillsController.php
/**
     * Show the form for editing the specified resource.
     *
     * @param  \App\Models\Bills  $bills
     * @return \Illuminate\Http\Response
     */
Show the form for editing the specified resource.
Show the form for editing the specified resource .
public function edit($id)
    {
        $bill = Bills::find($id);
        $bill['products'] = json_decode($bill['products'], true);
        $temp = $bill['total_amount'] - ($bill['total_amount'] * ($bill['discount']/100));
        $tax = $temp * ($bill['cgst']/100);
        $tax += $temp * ($bill['sgst']/100);
        $tax += $temp * ($bill['igst']/100);
        $bill['tax'] = $tax;
        $firms = Firm::orderBy('name')->get();
        $data['bill'] = $bill;
        $data['firms'] = $firms;
        return view('edit')->with($data);
    }
public function edit ( $ id ) { $ bill = Bills :: find ( $ id ) ; $ bill [ 'products' ] = json_decode ( $ bill [ 'products' ] , true ) ; $ temp = $ bill [ 'total_amount' ] - ( $ bill [ 'total_amount' ] * ( $ bill [ 'discount' ] / 100 ) ) ; $ tax = $ temp * ( $ bill [ 'cgst' ] / 100 ) ; $ tax += $ temp * ( $ bill [ 'sgst' ] / 100 ) ; $ tax += $ temp * ( $ bill [ 'igst' ] / 100 ) ; $ bill [ 'tax' ] = $ tax ; $ firms = Firm :: orderBy ( 'name' ) -> get ( ) ; $ data [ 'bill' ] = $ bill ; $ data [ 'firms' ] = $ firms ; return view ( 'edit' ) -> with ( $ data ) ; }
Show the form for editing the specified resource.
Show the form for editing the specified resource .