I have a VERY simple test app based on Laracasts which is not submitting data via in a very simple view and returns only the CSRF token and no data when submitting. I'm unclear what step I've missed...
My route is:
Route::post('/posts', 'PostsController@store');
My form in my View is:
<form method="POST" action="/posts">
{{ csrf_field() }}
<input type="hidden" id="mytest" value="denis">
<div class="form-group">
<label for="title">Title</label>
<input type="text" class="form-control" id="title" placeholder="title">
</div>
<div class="form-group">
<label for="body">Body</label>
<textarea class="form-control" id="body" placeholder="Body"></textarea>
</div>
<button type="submit" class="btn btn-primary">Publish</button>
</form>
My PostsController is:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class PostsController extends Controller
{
public function store()
{
dd(request()->all());
}
}
Posting of my form results in this:
array:1 [
"_token" => "43xJev3Xo2hh88r0IoHRJpoNhn4w3eVztgxbpNAY"
]
And NOT something like this (which is the problem):
array:1 [
"_token" => "43xJev3Xo2hh88r0IoHRJpoNhn4w3eVztgxbpNAY"
"title" => "My test post title"
"body" => "My test body value"
]