Answer the question
In order to leave comments, you need to log in
How to make routing and controllers work in laravel?
I started learning Laravel, installed version 5.1, I did everything according to the instructions:
laravel.com/docs/master/controllers#basic-controllers
An error occurs at localhost/blog/user/1 :
ReflectionException in Container.php line 736:
Class App\Http\Controllers\UserController does not exist
Route::get('/', function () {
return 'Hello world!';
});
<?php
namespace App\Http\Controllers;
use App\Http\Controllers\Controller;
class UserController extends Controller
{
/**
* Show the profile for the given user.
*
* @param int $id
* @return Response
*/
public function showProfile($id)
{
return view('user.profile', ['user' => User::findOrFail($id)]);
}
}
Route::get('user/{id}', '[email protected]');
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question