I have Laravel running on a Vagrant virtual server
Basic route works
Route::get('/', function() { return 'Hello World 007'; });
this also works
Route::get('/scotch', function() { return 'Hello my wonderful scotch'; });
but if I try
Route::get('/', 'AlbumsController@index');
then i get an error
I have an AlbumsController.php file with a function index() that return View::make('index')
I have an Album model that extends Eloquent (not really in use yet)
I have an index.blade.php file
how do I debug what is happening on that get?
I also just tried:
Route::get('/create', 'AlbumsController@create');
and that worked, so what is throwing off the index page?
I get a "Whoops, looks like something went wrong." error page
Enable debugging in app/config/app.php
(or in the relevant environment folder) and then try again, line 16, switch from false to true. During development you should enable debugging for error messages.
If you have two routes with the same URL you could get conflict between those routes.
If you try to use:
Route::get('/', function() { return 'Hello World 007'; });
You need to comment the following route:
Route::get('/', 'AlbumsController@index');
Because you are overlapping the action of the first closure function with the index action of the AlbumsController.
Hope it helps you.
I just installed Laravel and faced this issue. Changing my controller function to 'public static ' solved this issue for me. :)
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community