app/Http/Controllers/HomeController.php
//Confirm a product is available for hire
Confirm a product is available for hire
Confirm a product is available for hire
public function confirm($hire_on) {
        $hiredproduct = new HiredProduct;
        $hiredproduct->status = 'confirmed';
        $affected = DB::table('hired_products')
                        ->where('hired_at', $hire_on)
                        ->update(['status' => 'confirmed']);
        if($affected) {
            return redirect()->route('hired_products')->with('success', 'Offer Confirmed successfully!!');
        } else {
            return redirect()->route('hired_products')->with('error', 'There was an error confirming the offer! Please Try Again');
        }
    }
public function confirm ( $ hire_on ) { $ hiredproduct = new HiredProduct ; $ hiredproduct -> status = 'confirmed' ; $ affected = DB :: table ( 'hired_products' ) -> where ( 'hired_at' , $ hire_on ) -> update ( [ 'status' => 'confirmed' ] ) ; if ( $ affected ) { return redirect ( ) -> route ( 'hired_products' ) -> with ( 'success' , 'Offer Confirmed successfully!!' ) ; } else { return redirect ( ) -> route ( 'hired_products' ) -> with ( 'error' , 'There was an error confirming the offer! Please Try Again' ) ; } }
Confirm a product is available for hire
Confirm a product is available for hire
// $product = Product::find($id); // dd($affected); //$product->update('status' => 0);