title: Laravel 5.4 Error when create user
body: <p>Hi i got problem when i create user. I got this error:
  <strong>FatalThrowableError in SessionGuard.php line 407: Type error: Argument 1 passed to Illuminate\Auth\SessionGuard::login() must implement interface Illuminate\Contracts\Auth\Authenticatable, null given, called in /home/mariusz/Pulpit/www/szpital/vendor/laravel/framework/src/Illuminate/Foundation/Auth/RegistersUsers.php on line 35</strong></p>
  
  <p>User is created anyway but this error is so anoying and i dont know how fix it.
  I use laravel auth and i little edit register controller becouse i need add role for user and now my controller looks like that.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?php
  
  namespace App\Http\Controllers\Auth;
  
  use App\User;
  use App\Role;
  use App\Http\Controllers\Controller;
  use Illuminate\Support\Facades\Validator;
  use Illuminate\Foundation\Auth\RegistersUsers;
  use Illuminate\Support\Facades\Auth;
  
  class RegisterController extends Controller
  {
      /*
      |--------------------------------------------------------------------------
      | Register Controller
      |--------------------------------------------------------------------------
      |
      | This controller handles the registration of new users as well as their
      | validation and creation. By default this controller uses a trait to
      | provide this functionality without requiring any additional code.
      |
      */
  
      use RegistersUsers;
  
      /**
       * Where to redirect users after registration.
       *
       * @var string
       */
      protected $redirectTo = '/home';
  
      /**
       * Create a new controller instance.
       *
       * @return void
       */
      public function __construct()
      {
          $this-&gt;middleware('guest');
      }
  
      /**
       * Get a validator for an incoming registration request.
       *
       * @param  array  $data
       * @return \Illuminate\Contracts\Validation\Validator
       */
      protected function validator(array $data)
      {
          return Validator::make($data, [
              'name' =&gt; 'required|max:255',
              'lastname' =&gt; 'required|max:255',
              'phonenumber' =&gt; 'required|max:255',
              'email' =&gt; 'required|email|max:255|unique:users',
              'password' =&gt; 'required|min:6|confirmed',
          ]);
      }
  
  
      /**
       * Create a new user instance after a valid registration.
       *
       * @param  array  $data
       * 
       */
  
       public function create(array $data)
      {
          $user = new User();
          $user-&gt;name = $data['name'];
          $user-&gt;lastname = $data['lastname'];
          $user-&gt;phonenumber = $data['phonenumber'];
          $user-&gt;email = $data['email'];
          $user-&gt;password = bcrypt($data['password']);
          $user-&gt;save();
          $user-&gt;roles()-&gt;attach(Role::where('name', 'User')-&gt;first());
          Auth::login($user);
          
          
      }
  }</code></pre>
  </div>
  </div>
  
  I dont know mybe i shouldnt edit it. I want explain when i got this error:
  1.I go to page create acc.
  2.I write name etc.
  3.When i click create i got error 
  4. Next when i refresh page user is created,login and redirect to home page.</p>