Tell me more ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a working laravel installation to which I wanted to add a route but it wouldn't work.

Route::get('asdf', function() {return "asdf";});

All the other routes work but new ones don't, not even controller ones. I have just tried to simplify an example above to post here.

  1. I created a github project with the full project laravella\laravella
  2. Cloned the project
  3. Deleted compiled.php
  4. Ran composer install
  5. Ran php artisan dump-autoload
  6. Ran php artisan serve --port 80

The server console reports this error :

[Fri Jul 12 10:11:11 2013] 127.0.0.1:51042 Invalid request (Unexpected EOF)
[Fri Jul 12 10:11:11 2013] 127.0.0.1:51043 Invalid request (Unexpected EOF)
[Fri Jul 12 10:11:11 2013] 127.0.0.1:51044 Invalid request (Unexpected EOF)

Below is the log.

Thanks.

[2013-07-12 08:29:44] log.ERROR: exception 'Symfony\Component\HttpKernel\Exception\NotFoundHttpException' in C:\xampp\htdocs\lv\laravella\vendor\laravel\framework\src\Illuminate\Routing\Controllers\Controller.php:290
Stack trace:
#0 [internal function]: Illuminate\Routing\Controllers\Controller->missingMethod(Array)
#1 C:\xampp\htdocs\lv\laravella\vendor\laravel\framework\src\Illuminate\Routing\Controllers\Controller.php(138): call_user_func_array(Array, Array)
#2 C:\xampp\htdocs\lv\laravella\vendor\laravel\framework\src\Illuminate\Routing\Controllers\Controller.php(115): Illuminate\Routing\Controllers\Controller->callMethod('missingMethod', Array)
#3 C:\xampp\htdocs\lv\laravella\bootstrap\compiled.php(4741): Illuminate\Routing\Controllers\Controller->callAction(Object(Illuminate\Foundation\Application), Object(Illuminate\Routing\Router), 'missingMethod', Array)
#4 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}(Array)
#5 C:\xampp\htdocs\lv\laravella\bootstrap\compiled.php(7810): call_user_func_array(Object(Closure), Array)
#6 C:\xampp\htdocs\lv\laravella\bootstrap\compiled.php(7797): Illuminate\Routing\Route->callCallable()
#7 C:\xampp\htdocs\lv\laravella\bootstrap\compiled.php(4752): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#8 C:\xampp\htdocs\lv\laravella\bootstrap\compiled.php(480): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#9 C:\xampp\htdocs\lv\laravella\bootstrap\compiled.php(469): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#10 C:\xampp\htdocs\lv\laravella\public\index.php(49): Illuminate\Foundation\Application->run()
#11 C:\xampp\htdocs\lv\laravella\server.php(19): require_once('C:\xampp\htdocs...')
#12 {main} [] []
share|improve this question
Do you run PHP 5.4? Try to use other, non PHP server. Run curl localhost:8888/laravel-clean/public/asdf What is the output? – Andreyco yesterday
curl works if I remove the other routes in the routes.php – dataphile yesterday
I have moved the '/' route to the bottom of the routes.php file and everything seems to work now. – dataphile yesterday
thanks Andreyco – dataphile yesterday

1 Answer

Make sure Route::get('asdf', function() {return "asdf";}); is above controller routes if you have any because controller routes are greedy they won't let Route::get() handle their routes as it should have.

Edit Looking at your github clone routes.php its like

Route::controller('account', 'AccountController');
Route::controller('/', 'HomeController');
Route::get('asdf', function() {return "asdf";});

so in order to make your Route::get('asdf','...'); to work just add it above controller routes ex-

Route::get('asdf', function() {return "asdf";});
Route::controller('account', 'AccountController');
Route::controller('/', 'HomeController');

And it will work

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.