I am new to Laravel. I am learning how to create user registration page. Everything works fine but I am stuck in a simple problem.
ErrorException in UrlGenerator.php line 304: Route [signup] not defined. (View: C:\Program Files (x86)\Ampps\www\social\resources\views\welcome.blade.php)
But I defined signup route. Here is my routes.php file
Route::get('/', function () {
return view('welcome');
})->name('home');
Route::post('/signup', [
'uses' => 'UserController@postSignUp',
'as' => 'signup'
]);
And this is my UserController.php
class UserController extends Controller
{
public function postSignUp(Request $request)
{
$email = $request['email'];
$first_name = $request['frist_name'];
$password = bcrypt($request['password']);
$user = new User();
$user->email = $email;
$user->frist_name = $first_name;
$user->password = $password;
$user->save();
return redirect()->back();
Blade file is welcome.blade.php
<form action="{{ route('signup') }}" method="post">
<div class="form-group">
<label for="email"> Your E-mail </label>
<input class ="form-control" type="text" id="email" name="email" >
</div>
I would be much obliged if anyone could help me. Thanks
Oh, Sorry. I forget to mention that I am using Laravel version: 5.4.11
composer install
andphp artisan route:clear
. - Stuart Wagnerphp artisan route:list
and make sure your 'signup' route shows up. - Stuart WagnerNotFoundHttpException in RouteCollection.php line 161
- Maruf Alom