Lorsque j'essaie de charger mon projet sur le navigateur web. Il montre l'en-tête et le pied de page, mais la section centrale contenant le formulaire est manquante, et je ne comprends pas ce que je fais de mal ?
views/welcome.blade :
<!DOCTYPE html>
<html lang="en">
<head>
@include('partials._head')
</head>
<body>
@include('partials._nav')
<div class="container">
@include('partials._messages')
@yield('content')
@include('partials._footer')
</div>
@include('partials._javascript')
</body>
</html>
views/user_auth/user_register.blade :
@extends('welcome')
@section('title')
Welcome!!
@endsection
@section('content')
{!! Form::open(['route' => 'signup']) !!}
{{ Form::label('user_name','Name:') }}
{{ Form::text('user_name',null,['class' => 'form-control']) }}
{{ Form::label('email','E-mail:') }}
{{ Form::text('email',null,['class' => 'form-control']) }}
{{ Form::label('mobile_num','Mobile No.:') }}
{{ Form::text('mobile_num',null,['class' => 'form-control']) }}
{{ Form::label('address','Address:') }}
{{ Form::text('address',null,['class' => 'form-control']) }}
{{ Form::label('state','State:') }}
{{ Form::text('state',null,['class' => 'form-control']) }}
{{ Form::label('city','City:') }}
{{ Form::text('city',null,['class' => 'form-control']) }}
{{ Form::label('district','District:') }}
{{ Form::text('district',null,['class' => 'form-control']) }}
{{ Form::submit('Register',array('class' => 'btn btn-success btn-lg btn- block form-spacing-top')) }}
{!! Form::close() !!}
@endsection
Contrôleur d'enregistrement :
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
class RegisterController extends Controller
{
public function getRegistrationPage()
{
return view('user_auth.user_register');
}
public function postSignUp(Request $request)
{
$this -> validate($request,[
'email' => 'required|email|unique:users',
'name' => 'required|max:20',
'mobile_num' => 'required|digits:10',
'address' => 'required',
'city' => 'required',
'district' => 'required',
'state' => 'required',
'password' => 'required|min:4'
]);
$email = $request['email'];
$name = $request['name'];
$mobile_num = $request['mobile_num'];
$address = $request['address'];
$city = $request['city'];
$district = $request['district'];
$state = $request['state'];
$password = bcrypt($request['password']);
$user = new User();
$user->email =$email;
$user->name = $name;
$user->mobile_num = $mobile_num;
$user->address = $address;
$user->city = $city;
$user->district = $district;
$user->state = $state;
$user->password = $password;
$user->save();
return redirect()->route('dashboard');
Auth::login($user);
}
public function postSignIn(Request $request)
{
$this -> validate($request,[
'mobile_num' => 'required',
'password' => 'required'
]);
if(Auth::attempt(['mobile_num' => $request['mobile_num'], 'password' => $request['password']])) {
return redirect()->route('dashboard');
}
return redirect()->back();
}
public function getDashboard()
{
return view('pages.dashboard');
}
}
routes/web.php :
Route::group(['middleware' => ['web']], function(){
Route::get('/', function () {
return view('welcome');
})->name('home');
Route::post('/signup',[
'uses' => 'RegisterController@postSignUp',
'as' => 'signup'
]);
Route::post('/signin',[
'uses' => 'RegisterController@postSignIn',
'as' => 'signin'
]);
Route::get('/dashboard',[
'uses' => 'RegisterController@getDashboard',
'as' => 'dashboard',
'middleware' => 'auth'
]);
Route::get('/register',[
'uses' => 'RegisterController@getRegistrationPage',
'as' => 'register',
'middleware' => 'auth'
]);
});