I created a controller in Laravel, but when I call a method on the Controller it shows the following error:
BadMethodCallException Method [Register] does not exist on [App\Http\Controllers\UserController].
Controller Code:
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use App\User;
class UserController extends Controller
{
public function Index()
{
echo "hello";
}
public function Register()
{
$user = new User();
$user->name = "Aisha";
$user->email = "[email protected]";
$user->password = "TestPass";
$user->remember_token = str_random(16);
$user->save();
}
}
Route:
Route::get('/user/register','UserController@Register');