i have laravel project where on submit the form m getting error page not found whereas i have created route and all
routes :
Route::get('/', 'IndexController@index');
Route::post('/remove/{product}', 'ProductController@removeProduct')->name('remove');
Route::group(['as' => 'cart.', 'prefix' => 'cart'], function () {
Route::post('/update/{product}', 'ProductController@updateProduct')->name('update');
});
Route::get('cart', 'ProductController@cart')->name('all');
Route::get('/{type}', 'IndexController@loadview');
view file :
<form action="" method="POST" accept-charset="utf-8">
@csrf
<input type="submit" name="remove" value="x Remove" class="btn btn-danger"/>
</form>
ProductController :
public function removeProduct(Product $product){
return 'something';
$oldCart = Session::has('cart') ? Session::get('cart') : null;
$cart = new Cart($oldCart);
$cart->removeProduct($product);
Session::put('cart', $cart);
return back()->with('message', "Product $product->title has been successfully removed From the Cart");
}
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2HWdLNG
via IFTTT
Aucun commentaire:
Enregistrer un commentaire