jeudi 2 mars 2017

How to validate auth form data in Laravel 5.3

I'm trying to build out authentication in Laravel 5.3. For some reason my form data isn't being validated by the register function in the RegisterUsers.php file. When I fill out the form and send it I get 3 errors telling me the 3 fields are required; Like the data isn't even being passed. I'm not using php artisan make:auth or laravel collectives, I maybe I should. Is there something obvious I'm doing wrong here? Thanks, in advance.

register.blade.php

@extends('main')
@section('title','Register')
@section('content')
    <form action='' method='POST'>
         
        <div class='row well'>
            <div class='col-md-6 col-md-offset-3'>
                <div class='form-group'>
                    <label for='name'>Name</label>
                    <input type='text' id='name' class='form-control'>
                </div>
                <div class='form-group'>
                    <label for='email'>Email</label>
                    <input type='text' id='email' class='form-control'>
                </div>
                <div class='form-group'>
                    <label for='password'>Password</label>
                    <input type='password' id='password' class='form-control'>
                </div>
                <div class='form-group'>
                    <label for='password'>Confirm Password</label>
                    <input type='password' id='password' class='form-control'>
                </div>
                <div class='form-group'>
                    <label for='pw-remember'>Remember Me</label>
                    <input type='checkbox' id='pw-remember' class='form-control'>
                </div>

                <input type='submit' value='Login' class='btn btn-success btn-block'>
            </div>
        </div>
    </form>
@endsection

web.php

// auth routes
Route::get('auth/login', 'Auth\LoginController@showLoginForm');
Route::post('auth/login', 'Auth\LoginController@login');
Route::post('auth/logout', 'Auth\LoginController@logout');
// Registration routes
Route::get('auth/register', 'Auth\RegisterController@showRegistrationForm');
Route::post('auth/register', 'Auth\RegisterController@register');

Route::get('blog/{slug}', ['as' => 'blog.single', 'uses' => 'BlogController@getSingle'])->where('slug', '[\w\d\-\_]+');
Route::get('blogs', 'BlogController@getIndex');
Route::get('/', 'PageController@getIndex');
Route::get('about', 'PageController@getAbout');
Route::get('contact', 'PageController@getContact');

Route::resource('posts', 'PostController');



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire