0

So the error I am getting is Symfony \ Component \ HttpKernel \ Exception \ NotFoundHttpException.

Here is the route:

Route::get('/', 'AuthController@index');
Route::get('/login', 'AuthController@login');
Route::post('/login', ['before' => 'csrf', 'uses' => 'AuthController@authenticate']);
Route::get('/logout', 'AuthController@logout');

Route::group(['before' => 'auth'], function() {

$noIndex = [ 'except' => ['index'] ];
$noShow = [ 'except' => ['show'] ];

Route::get('/dashboard', 'PagesController@dashboard');

Route::get('/test', 'MessageController@index');

Here is the controller:

/**
 * Display a listing of the resource.
 * GET /test
 *
 * @return Response
 */
public function index()
{
    return View::make('test.index');
}
will.i.am
  • 13
  • 1
  • 5
  • Is the controller namespaced? You also don't need the leading `/` on your route, `Route::get('test'...` is fine – Joe Sep 25 '14 at 14:10
  • no it is not it is just sitting in the controller folder with the base controller and the pages controller. – will.i.am Sep 25 '14 at 14:11
  • What's the URL you are using? Can you paste the output of `php artisan routes`? – lowerends Sep 25 '14 at 14:35
  • This question is a likely duplicate of [this](http://stackoverflow.com/questions/26017372/routing-issue-causing-symfony-component-httpkernel-exception-notfoundhtt/26020851?noredirect=1#comment40756211_26020851), [this](http://stackoverflow.com/questions/25892238/do-not-understand-why-i-keep-getting-this-error-symfony-component-httpkerne?rq=1), and [this](http://stackoverflow.com/questions/25997303/i-am-getting-symfony-component-httpkernel-exception-methodnotallowedhttp?rq=1). If you are the same poster, you'll have better luck keeping this in one thread. – damiani Sep 25 '14 at 14:36
  • @lowerends here you go | MessageController@index | auth | | – will.i.am Sep 25 '14 at 14:48
  • @damiani the questions are similar but I didn't ask them and they don't help anyone because they don't have answers. – will.i.am Sep 25 '14 at 14:49
  • Ok, looks like you're using a `before` `auth` filter. Can you post your complete `routes.php` file? – lowerends Sep 25 '14 at 14:58
  • ...and please post what URL you are using, as requested above, and your Virtual Host setting. It's possible your Virtual Host setting is incorrect, see [this answer](http://stackoverflow.com/questions/23593892/symfony-component-httpkernel-exception-notfoundhttpexception-laravel?rq=1). – damiani Sep 25 '14 at 15:01
  • @lowerends i don't have access to the other routes right now my project manager is sick. – will.i.am Sep 25 '14 at 15:03
  • @damiani I apologize I don't see that asked above here it is desk.dev:8000/test – will.i.am Sep 25 '14 at 15:05
  • 1) Please post the contents of `public/.htaccess`; and (2) are you running this using Homestead and a Vagrant virtual machine? – damiani Sep 25 '14 at 15:15
  • @damiani 1. Options -MultiViews RewriteEngine On # Redirect Trailing Slashes... RewriteRule ^(.*)/$ /$1 [L,R=301] # Handle Front Controller... RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-f RewriteRule ^ index.php [L] 2. yes I am currently using homestead and vagrant virtual machine – will.i.am Sep 25 '14 at 15:20
  • OK, please post the contents of your `Homestead.yaml` file from the Homestead directory. – damiani Sep 25 '14 at 15:22
  • --- ip: "192.168.10.10" memory: 2048 cpus: 1 authorize: /Users/me/.ssh/id_rsa.pub keys: - /Users/me/.ssh/id_rsa folders: - map: /Users/me/code to: /home/vagrant/Code sites: - map: test.app to: /home/vagrant/Code/test/public - map: desk.dev to: /home/vagrant/Code/desk/public - map: web.dev to: /home/vagrant/Code/website/public variables: - key: APP_ENV value: local – will.i.am Sep 25 '14 at 15:36
  • Are the routes of your other sites, `test.app` and `web.dev`, working? – damiani Sep 25 '14 at 15:46
  • yes they are working – will.i.am Sep 25 '14 at 16:30
  • Post your whole `routes.php` file (when your project manager is feeling better :) ), post your `auth` filter, and/or try removing your `auth` filter. The problem could be in there. – damiani Sep 25 '14 at 16:35
  • Route::get('/', 'AuthController@index'); Route::get('/login', 'AuthController@login'); Route::post('/login', ['before' => 'csrf', 'uses' => 'AuthController@authenticate']); Route::get('/logout', 'AuthController@logout'); Route::group(['before' => 'auth'], function() { $noIndex = [ 'except' => ['index'] ]; $noShow = [ 'except' => ['show'] ]; Route::get('/dashboard', 'PagesController@dashboard'); Route::get('/test', 'MessageController@index'); – will.i.am Sep 25 '14 at 17:15

1 Answers1

0

Now that we have some more complete information regarding your routes.php setup, it's possible that the problem is due to the auth filter.

(I'm assuming you left off the final }); from your routes.php above.)

Try removing the before filter (or change it temporarily to ['before' => 'none']) and reload desk.dev:8000/test. Make sure you don't simply hit reload on the current error page, since it may be pointing to desk.dev:8000/login.

If your AuthController is not set up, or is missing the login method, you will get a NotFoundHttpException when the auth filter in filter.php tries to redirect to your login page, with:

return Redirect::guest('login'); 
damiani
  • 7,071
  • 2
  • 23
  • 24