Could you format your code with with 3 "`" before and after ?
I think you miss the namespace in your controller.
<?php namespace App\Http\Controllers;
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
I 'm beginning to test Laravel and I 'm doing with version 5 but I am having problems with controllers. It happens that in a very simple example where I want test a route, Laravel 5 tells me not to get that URL.
The controller is this :
use App\Http\Requests;use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
class AboutController extends Controller {
function index()
{
return "some message";
}
}
The routes are:
Route::get('about', 'AboutController@index');
Route::get('/', 'WelcomeController@index');
Route::get('home', 'HomeController@index');
Route::controllers([ 'auth' => 'Auth\AuthController', 'password' => 'Auth\PasswordController', ]);
When i try http://localhost/laravel/public/about/ appears the message: The requested URL /laravel/public/about/ was not found on this server.
The routes via php artisan:list are:
+--------+--------------------------------+-------------------------------------------------------+------+------------------------------------------------------------+------------+ | Domain | Method | URI | Name | Action | Middleware | +--------+--------------------------------+-------------------------------------------------------+------+------------------------------------------------------------+------------+
| | GET|HEAD | about | | App\Http\Controllers\AboutController@index | |
| | GET|HEAD | / | | App\Http\Controllers\WelcomeController@index | guest |
| | GET|HEAD | home | | App\Http\Controllers\HomeController@index | auth |
| | GET|HEAD | auth/register/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\AuthController@getRegister | guest |
| | POST | auth/register/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\AuthController@postRegister | guest |
| | GET|HEAD | auth/login/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\AuthController@getLogin | guest |
| | POST | auth/login/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\AuthController@postLogin | guest |
| | GET|HEAD | auth/logout/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\AuthController@getLogout | |
| | GET|HEAD|POST|PUT|PATCH|DELETE | auth/{_missing} | | App\Http\Controllers\Auth\AuthController@missingMethod | guest |
| | GET|HEAD | password/email/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\PasswordController@getEmail | guest |
| | POST | password/email/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\PasswordController@postEmail | guest |
| | GET|HEAD | password/reset/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\PasswordController@getReset | guest |
| | POST | password/reset/{one?}/{two?}/{three?}/{four?}/{five?} | | App\Http\Controllers\Auth\PasswordController@postReset | guest |
| | GET|HEAD|POST|PUT|PATCH|DELETE | password/{_missing} | | App\Http\Controllers\Auth\PasswordController@missingMethod | guest |
+--------+--------------------------------+-------------------------------------------------------+------+------------------------------------------------------------+------------+
Please or to participate in this conversation.