Thursday, April 13, 2017

Laravel framework [duplicate]

Please look into two error images at the end. It says undefined varialbe total. But i already defined it, still it says error.Please help me n let me know where's the mistake

This is my checkout.blade.php

<div class="col-sm-6 col-md-4 col-md-offset-4 col-sm-offset-3">
<h1><strong style="color: purple; font-size:40px">CHECKOUT</strong></h1>
<h4 style="color: maroon; font-size: 35px">Your Total: $</h4>
<form action="  " method="post" id="checkout-form">
<div class="row" style="font-size: 20px; color: grey">
<div class="col-xs-12">
<div class="form-group">
<label for="name">Name</label>
<input type="text" id="name" class="form-control" required>
</div></div>                

<button type="submit" class="btn btn-success" style="font-size: 20px">Buy Now</button>
</div>
</form>
</div></div></div></div>

This is my ProdcutController.php

        public function getCheckout()
            { $oldCart= Session::get('cart');
                $cart= new Cart($oldCart);
                $total= $cart->totalPrice;
                return view('shop.checkout',['total=> $total']);
            }
        }

This is my routes

    Route::get('/checkout',[
        'uses' =>'ProductController@getCheckout',
        'as' => 'checkout'

        ]);

    Route::post('/checkout',[
    'uses'=> 'ProductController@postCheckout',
    'as'=>'checkout'
        ]);

And this is what i am getting an error

error 1 error 2



via Heebah Saleem

Advertisement