Support the ongoing development of Laravel.io →
posted 3 years ago
Last updated 2 years ago.
0

Hi Peter you can simply use this for POST Methods: `<form method="POST" action="{{ route('CustUpdateCart1.route', $id) }}"> @csrf

</form> ` and use this for DELETE

`<form method="POST" action="{{ route('MyDelCustCart1.route', $id) }}"> @csrf @method('DELETE')

</form> `

i this may fix your issue

Last updated 3 years ago.
0

Hi Jean Claude, I am producing the from as html from the controller datatable, I cannot use @csrf @method('DELETE') here, I am not using it in the blade, I am bringing it as databale from the controller and requesting it as ajax from the blade as datatable function

0

SOLUTION:

		<form method=\"Post\" action=".route('CustUpdateCart1.route', [$id])." >"
					.csrf_field(). method_field('PUT') ."

					<input type = 'text' name = 'quan' value = \"$quan\" style = 'width:45px;'>
					<input name='_method' type='hidden' value='PUT'>
					
					<input type=\"hidden\" value=\"$id\" name=\"id\">
					<input type=\"hidden\" name=\"_token\" value=\"$token\">
					<input type = 'submit' value = 'update' />
					
					</form>
					</div>
					<div style = 'display:inline;float:left;margin-left:5px;'>
				
					<form method=\"Post\" action=".route('MyDelCustCart1.route', [$id])." >"
					.csrf_field(). method_field('DELETE') ."
					
					
					
					<input type=\"hidden\" value=\"$id\" name=\"id\">
					<input name=\"_method\" type=\"hidden\" value=\"DELETE\">
					<input type=\"hidden\" name=\"_token\" value=\"$token\">
					<input type = 'submit' value = 'delete' onclick = 'return confirm(\"are you sure you want to remove this item\");'/>
					</form>
0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.