app/Http/Controllers/TransactionController.php
/**
     * Remove the specified resource from storage.
     *
     * @param  \App\Transaction  $transaction
     * @return \Illuminate\Http\Response
     */
Remove the specified resource from storage.
Remove the specified resource from storage .
public function destroy($id)
    {
        $transaction = Transaction::where('id',$id)->first();
        $car = Car::where('id',$transaction->car_id)->first();
        $car->update([
            'car_stock' => $car->car_stock + 1
        ]);
        $transaction->delete();
        return back()->with('error','Data Successfully Deleted');
    }
public function destroy ( $ id ) { $ transaction = Transaction :: where ( 'id' , $ id ) -> first ( ) ; $ car = Car :: where ( 'id' , $ transaction -> car_id ) -> first ( ) ; $ car -> update ( [ 'car_stock' => $ car -> car_stock + 1 ] ) ; $ transaction -> delete ( ) ; return back ( ) -> with ( 'error' , 'Data Successfully Deleted' ) ; }
Remove the specified resource from storage.
Remove the specified resource from storage .