I have function that generate a form from a model.
Category Model:
public static function generateForm()
{
$output = '';
$output .= '<form action="/category" method="post">
'. csrf_field() .'
<input type="text">
<input type="submit" value="Submit" id="">
</form>';
return $output;
}
It's not working. In my *view it's showing the hidden input token but doesn't get any value.
You can pass
csrf_tokendynamically from view to that function html.Here is the example of that:-
Category.php
Now you need to pass only parameter to this function where you are calling. Like this:-
view.blade.php