Friday, March 3, 2017

Why does the Route not working even if the controller callback is correct in Laravel 5.4?

I don't understand why I'm having an error below even if the controller callback is correct.

Server error

500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.

My Route below:

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

And my Controller method:

namespace App\Http\Controllers;

use Illuminate\Http\Request;

class TestController extends Controller
{
    /**
     * Display a listing of the resource.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        return 'Hello World.';
    }
}

However, if I do Route::get('tests',, note the plural word tests in the uri, it works! but this Route::get('test',, with the singular word test does not.

What could be the reason?



via anagnam

Advertisement