Reputation: 189
I'm using Laravel 5.2 and caffeinated Modules and I'm getting this error
NotFoundHttpException in RouteCollection.php line 161:
I only get this error when I upload to my server but on my localhost I don't get an error.
I've also noticed that on my localhost I get all my routes listed but on my server I only have the home page.
My Users Module route.php
Route::group(['middleware' => 'web'], function()
{
Route::get('admin/', [
'uses' => 'UsersController@showLogin',
'as' => 'login'
]);
Route::post('admin/', [
'uses' => 'UsersController@doLogin',
'as' => 'doLogin'
]);
});
and my Users Module UsersController.php
<?php
namespace App\Modules\Users\Http\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class UsersController extends Controller
{
public function showLogin(){
echo "Users Controller";
}
}
If there is anything I've missed to help with this please let me know.
Upvotes: 0
Views: 217
Reputation: 4750
This error generally shown when you access a url which is not defined in your route file. Recheck the url you are trying to access.
Your code doesn't seem to have any special error.
Add a doLogin
method in your UsersController
.
Besides, you can try by removing /
from the route path.
I mean change this:
Route::group(['middleware' => 'web'], function()
{
Route::get('admin/', [
'uses' => 'UsersController@showLogin',
'as' => 'login'
]);
Route::post('admin/', [
'uses' => 'UsersController@doLogin',
'as' => 'doLogin'
]);
});
to this:
Route::group(['middleware' => 'web'], function()
{
Route::get('admin', [
'uses' => 'UsersController@showLogin',
'as' => 'login'
]);
Route::post('admin', [
'uses' => 'UsersController@doLogin',
'as' => 'doLogin'
]);
});
Upvotes: 1
Reputation: 189
I finally found the answer. I had to delete the /storage/app/modules.json and then I ran
php artisan module:optimize
Upvotes: 0