First And For most, I wouldn't ask here if I didn't do some research myself yet, I saw many similar titled Questions, but they seem to not be the same problem that I have.
=Actual Start=
So I am following this Web Tutorial Series called Laravel 5.2 PHP Build a social network and I am stuck at the end of the third episode. My problem is that when I try to click the Sign Up Button, I get this Error:
1/1
NotFoundHttpException in RouteCollection.php line 161:
in RouteCollection.php line 161
at RouteCollection->match(object(Request)) in Router.php line 755
at Router->findRoute(object(Request)) in Router.php line 610
at Router->dispatchToRoute(object(Request)) in Router.php line 596
at Router->dispatch(object(Request)) in Kernel.php line 267
at Kernel->Illuminate\Foundation\Http\{closure}(object(Request)) in Pipeline.php line 53
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in CheckForMaintenanceMode.php line 46
at CheckForMaintenanceMode->handle(object(Request), object(Closure)) in Pipeline.php line 137
at Pipeline->Illuminate\Pipeline\{closure}(object(Request)) in Pipeline.php line 33
at Pipeline->Illuminate\Routing\{closure}(object(Request)) in Pipeline.php line 104
at Pipeline->then(object(Closure)) in Kernel.php line 149
at Kernel->sendRequestThroughRouter(object(Request)) in Kernel.php line 116
at Kernel->handle(object(Request)) in index.php line 54
I tried Fixing the web.php
, welcome.blade.php
, UserController.php
Can anyone help me understand what is wrong?
web.php
<?php
/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/
Route::get('/', function () {
return view('welcome');
});
Route::post('/signup', [
'uses' => 'UserController@postSignUp',
'as' => 'signup'
]);
UserController.php
<?php
namespace App\Http\Controllers;
use App\User;
use Illuminate\Http\Request;
class UserController extends Controller
{
public function postSignUp(Request $request){
$email = $request['email'];
$first_name = $request['first_name'];
$password = bcrypt($request['password']);
$user = new User();
$user->email = $email;
$user->first_name = $first_name;
$user->password = $password;
$user->save();
return redirect()->back();
}
public function postSignIn(Request $request){
$email = $request['email'];
$password = $request['password'];
}
}
welcome.blade.php
@extends('layouts.master')
@section('title')
Welcome!
@endsection
@section('content')
<div class="row">
<div class="col-md-6">
<h3>Sign Up</h3>
<form action="{{route('signup')}}" method="POST">
<div class="form-group">
<label for="email">Your Email</label>
<input type="form-control" type="text" name="email" id="email">
</div>
<div class="form-group">
<label for="first_name">Your First Name</label>
<input type="form-control" type="text" name="first_name" id="first_name">
</div>
<div class="form-group">
<label for="password">Your Password</label>
<input type="form-control" type="password" name="password" id="password">
</div>
<button type="submit" class="btn btn-primary"> Submit</button>
<input type="hidden" name="_token" value="{{Session::token()}}">
</form>
</div>
<div class="col-md-6">
<h3>Sign In</h3>
<form action="#" method="post">
<div class="form-group">
<label for="email">Your Email</label>
<input type="form-control" type="text" name="email" id="email">
</div>
<div class="form-group">
<label for="password">Your Password</label>
<input type="form-control" type="password" name="password" id="password">
</div>
<button type="submit" class="btn btn-primary"> Submit</button>
</form>
</div>
</div>
@endsection
Go this when I ran: php artisan route:list
+--------+----------+----------+--------+------------------------------------------------+----------
----+
| Domain | Method | URI | Name | Action | Middlewar
e |
+--------+----------+----------+--------+------------------------------------------------+----------
----+
| | GET|HEAD | / | | Closure | web
|
| | GET|HEAD | api/user | | Closure | api,auth:
api |
| | POST | signup | signup | App\Http\Controllers\UserController@postSignUp | web
|
+--------+----------+----------+--------+------------------------------------------------+----------
----+
EDIT 11/21/2016 07:00 PM: It should be worth noting that while I am using Laravel 5.3, I'm not sure what the Presenter was using, but he was using a projec that has routes.php, i just tried to work around by using the web.php since it seems to be the closest thing to what i need to follow along the tutorial. I also have the link as http://localhost/hiro/public/