I have this code in laravel and used YAJRA as my datatable and upon submitting it says that the CSRF token is error, attached here is my code in Controller before rending in View/Blade. Here is my code:
$return = '<form method="post" action="/procurement/add-product">
'.{{ csrf_token() }}.'
<input type="hidden" name= "product_id" value=".$row->id.">
<input type="text" name="product_qty" class="form-control">
<button type="submit" class="btn btn-primary btn-block">Add Item</button>
</form>';
return $return;
I found an answer via documentation, https://laravel.com/docs/master/csrf I just put the URI of the said form
<?php
namespace App\Http\Middleware;
use Illuminate\Foundation\Http\Middleware\VerifyCsrfToken as BaseVerifier;
class VerifyCsrfToken extends BaseVerifier
{
/**
* The URIs that should be excluded from CSRF verification.
*
* @var array
*/
protected $except = [
//
'procurement/*',
];
}