Не могу понять проблему с этим маршрутом.вернуть ошибку 404.Я проверил таблицу списка маршрутов, и его маршрут находится внутри.так как я получаю 404, я предполагаю, что есть ошибка маршрутизации, может быть, опечатка, но я не смог ничего увидеть.я обновил этот пост, чтобы показать мои блейд-файлы ...
| Domain | Method | URI | Name | Action | Middleware |
+--------+----------+----------+--------+------------------------------------------------+--------------+
| | GET|HEAD | / | | Closure | web |
| | GET|HEAD | api/user | | Closure | api,auth:api |
| | POST | signup | signup | App\Http\Controllers\UserController@postSignUp | web |
+--------+----------+----------+--------+------------------------------------------------+--------------+
UserController:
use Illuminate\Http\Request;
use App\User;
class UserController extends Controller
{
/**
* @param Request $request
*/
public function postSignUp(Request $request)
{
$email = $request['email'];
$username = $request['username'];
$password = bcrypt($request['password']);
$user = new User();
$user->email = $email;
$user->username = $username;
$user->password = $password;
$user->save();
return redirect()->back();
}
public function postSignIn(Request $request)
{
}
}
/*
|--------------------------------------------------------------------------
| 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'
]);
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">Email:</label>
<input class="form-control" type="text" name="email" id="email">
</div>
<div class="form-group">
<label for="username">UserName:</label>
<input class="form-control" type="text" name="username" id="username">
</div>
<div class="form-group">
<label for="password">Password:</label>
<input class="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>
<div class="col-md-6">
<h3>Sign In</h3>
<form action="#" method="post">
<div class="form-group">
<label for="email">Email:</label>
<input class="form-control" type="text" name="email" id="email">
</div>
<div class="form-group">
<label for="password">Password:</label>
<input class="form-control" type="password" name="password" id="password">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
@endsection
master.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">Email:</label>
<input class="form-control" type="text" name="email" id="email">
</div>
<div class="form-group">
<label for="username">UserName:</label>
<input class="form-control" type="text" name="username" id="username">
</div>
<div class="form-group">
<label for="password">Password:</label>
<input class="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>
<div class="col-md-6">
<h3>Sign In</h3>
<form action="#" method="post">
<div class="form-group">
<label for="email">Email:</label>
<input class="form-control" type="text" name="email" id="email">
</div>
<div class="form-group">
<label for="password">Password:</label>
<input class="form-control" type="password" name="password" id="password">
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>
@endsection