I'm trying to implement the category creation form on the backend of a site I'm building. The idea is to have it be on the same page as the index of existing categories. At present, though, the creation system does nothing. It doesn't return an error; nothing shows up in the database when queried directly; and nothing new appears on the page as per the redirect. Because there's no feedback, I'm groping around for what's different/wrong about this route versus the very similar route I made for the post creation mechanism earlier. In any case, here's the relevant creation form:
<form method="POST" action="{{ route('categories.store') }}" data-parsley-validate>
<div class="form-group">
<label name="name">Category Name:</label>
<input id="name" name="name" class="form-control" required maxlength="255">
</div>
<input type="submit" value="Create" class="btn btn-lg btn-block">
<input type="hidden" name="_token" value="{{ Session::token() }}">
</form>
Here is the 'store' method from the CategoryController:
public function store(Request $request)
{
$this->validate($request, array(
'name' => 'required|max:255'
));
$category = new Category;
$category->name = $request->name;
$category->save();
Session::flash('success', 'Category has been created!');
return redirect()->route('categories.index');
}
And here is the web.php routes file:
<?php
Route::get('/', 'PageController@getIndex');
Route::get('/contact', 'PageController@getContact');
Route::resource('posts', 'PostController');
Route::resource('categories', 'CategoryController');
Route::get('blog/{slug}', 'PostController@show')->where('slug', '[\w\d\-\_]+');
Route::get('blog', 'PostController@index');
Auth::routes();
Route::get('/home', 'HomeController@index');
?>
Again, I'm not getting any error messages at all, it's just that the submission button does nothing. Thanks in advance!