what's the solution then?

6 months ago (623,140 XP)
// RegisterController.php
protected function validator(array $data)
    return Validator::make($data, [
        'username' =>'required|unique:users,
        'name' => 'required|max:255',
        'email' => 'required|email|max:255|unique:users',
        'password' => 'required|min:6|confirmed',

protected function create(array $data)
    return User::create([
        'username' => $data['name'],
        'name' => $data['name'],
        'email' => $data['email'],
        'password' => bcrypt($data['password']),

Of course, you need to send a username to the controller, so add a field to the registration form:

// register.blade.php
<div class="form-group{{ $errors->has('username') ? ' has-error' : '' }}">
    <label for="username" class="col-md-4 control-label">username</label>

    <div class="col-md-6">
        <input id="username" type="text" class="form-control" name="username" value="{{ old('username') }}" required autofocus>

        @if ($errors->has('username'))
            <span class="help-block">
                <strong>{{ $errors->first('username') }}</strong>


i added the username and it works thnks


@tykus This maybe a bit random but can you explain why we need to put this bit in to boot

public function boot()
if (Schema::hasTable('decisions')) {
    $badge = Decision::where('done',false)->count();

Why the boot. what does boot do? I partially know what boot does. All i know at this point is that laravel boots all the service providers before and calls everything inside of boot later. Am i wrong?

Care to spread the knowledge to a brother who is keen to seek? ;)

Please sign in or create an account to participate in this conversation.