I am building a module called Student in Laravel.
I use the routes.php file inside the Student folder to write routes realted to student module..
When I use just Route::get('/list', function () { return view('welcome');}); program working fine without error.
But when I am using Route::get('/list', 'StudentController@list'); there is a error.
Error is,
Class App\Http\Controllers\StudentController does not exist
Folder Structure
Student Controller
namespace App\Student\Controllers; use Illuminate\Http\Request; use App\Http\Controllers\Controller; class StudentController extends Controller { public function list(){ echo "Hello" } } Student Service Provider
namespace App\Student; use App\Providers\RouteServiceProvider as ServiceProvider; use Illuminate\Support\Facades\Route; class StudentServiceProvider extends ServiceProvider { /** * Bootstrap the application services. * * @return void */ public function boot() { parent::boot(); } /** * Register the application services. * * @return void */ public function register() { // } /** * Define the routes for the application. * * @internal param Router $router */ public function map() { Route::group([ 'namespace' => $this->namespace, 'prefix' => 'students', ], function ($router) { require __DIR__ . '/routes.php'; }); } } 
Route::get('student/list', 'StudentController@list');App\Providers\RouteServiceProviderandroutes.php?Route::get('/list', 'StudentController@list');line in students/routes.php. I have not touched RouteServiceProvider file. github.com/laravel/laravel/blob/master/app/Providers/…