I have a routes.php
/*
* Web
*/
Route::group(['namespace' => '\Smartii\Controllers\Web'], function() {
/*
* Home
*/
Route::get('/', 'HomeController@index');
/*
* Session
*/
Route::group(['prefix' => 'session'], function() {
Route::get('create', ['uses' => 'SessionController@create', 'as' => 'session.create']);
Route::post('', ['uses' => 'SessionController@store', 'as' => 'session.store']);
Route::delete('', ['uses' => 'SessionController@destroy', 'as' => 'session.destroy']);
});
});
which creates routes
+--------+-------------------------+-------------------+----------------------------------------------------+----------------+---------------+
| Domain | URI | Name | Action | Before Filters | After Filters |
+--------+-------------------------+-------------------+----------------------------------------------------+----------------+---------------+
| | GET|HEAD / | | \Smartii\Controllers\Web\HomeController@index | | |
| | GET|HEAD session/create | session.create | \Smartii\Controllers\Web\SessionController@create | | |
| | POST session | session.store | \Smartii\Controllers\Web\SessionController@store | | |
| | DELETE session | session.destroy | \Smartii\Controllers\Web\SessionController@destroy | | |
| | GET|HEAD communities | communities.index | Closure | | |
+--------+-------------------------+-------------------+----------------------------------------------------+----------------+---------------+
'''
When I post from /session/create to /session I get a new NotFoundHTTPException
I also tried moving my post route outside of the session group using
Route::post('session', ['uses' => 'SessionController@store', 'as' => 'session.store']);
and it didn't work. I don't think its the route file itself. Any ideas where else to look?
I apologise about the unmatched blocks. I can't seem to get the formatting to work using tildes.
Solved. I was accidentally using put to create the session instead of post.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community