I can get the following line in routes.php
file working to see the welcome message:
Route::get('/', 'HomeController@showWelcome');
But the following line does not work:
Route::get('/', function()
{
return HomeController::showWelcome();
});
And I get the following error in the browser:
Whoops, looks like something went wrong.
What's wrong?
Update: After setting debug to true, I figured out the problem is this:
Non-static method HomeController::showWelcome() should not be called statically
So in the HomeController.php, I change:
public function showWelcome()
{
return View::make('hello');
}
to:
static public function showWelcome()
{
return View::make('hello');
}
And the problem was fixed. I'm just not sure if this is the best workaround.