title: Why Method App\Http\Controllers\RegisterController::guard does not exist and MemberExtra table not fill with data in laravel
body: <p>thanks for helping
  I have some error when insert data i nto database, that is guard does not exit when I try to register by using this controller</p>
  <pre><code>namespace App\Http\Controllers;
  
  
  use App\Models\MemberExtra;
  use App\Models\User;
  use App\Http\Controllers\Controller;
  use Carbon\Carbon;
  use Illuminate\Support\Facades\Validator;
  use Illuminate\Foundation\Auth\RegistersUsers;
  use Illuminate\Http\Request;
  use Illuminate\Auth\Events\Registered;
  
  class RegisterController extends Controller
  {
     
      public function __construct()
      {
          $this-&gt;middleware('guest');
      }
  
      public function index(){
          return view('users.register');
      }
  
      protected function validator(array $data)
      {
          return Validator::make($data, [
              'email' =&gt; 'required|string|email|max:255|unique:users',
              'password' =&gt; 'required|string|min:6',
              'referrer_id' =&gt; 'required',
              'position' =&gt; 'required', 
              'username' =&gt; 'required',
          ]);
      }
  
      /**
       * Create a new user instance after a valid registration.
       *
       * @param  array  $data
       * @return \App\User
       */
      protected function create(array $data)
      {  
           $ref_id = $data['referrer_id'];
          $poss = $data['position'];
          $posid =  getLastChildOfLR($ref_id,$poss);
   
          return User::create([
              'email' =&gt; $data['email'],
              'password' =&gt; bcrypt($data['password']),
              'referrer_id' =&gt; $data['referrer_id'],
              'position' =&gt; $data['position'],
              'username' =&gt; $data['username'],
              'join_date' =&gt; Carbon::today(),
              'posid' =&gt; $posid       
          ]);
      }
      public function register(Request $request)
      {
          $this-&gt;validator($request-&gt;all())-&gt;validate();
          event(new Registered($user = $this-&gt;create($request-&gt;all())));
          $this-&gt;guard()-&gt;login($user);
          MemberExtra::create([
             'user_id' =&gt; $user['id'],
             'left_paid' =&gt; 0,
             'right_paid' =&gt; 0,
             'left_free' =&gt; 0,
             'right_free' =&gt; 0,
             'left_bv' =&gt; 0,
             'right_bv' =&gt; 0,
          ]);
         updateMemberBelow($user['id'], 'FREE');  
         return $this-&gt;registered($request, $user) ?: redirect()-&gt;route('home');
        
      }
  }
  
  </code></pre>
  <p>when register , show this error
  <a href="https://i.stack.imgur.com/eu3uW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/eu3uW.png" alt="enter image description here" /></a></p>
  <p>and I refresh the page , user data is inserted into database but MemberExtra data still not insert</p>
  <p><a href="https://i.stack.imgur.com/feyos.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/feyos.png" alt="enter image description here" /></a></p>
  <p>And this guard does not exist error happen again and again whenever register.
  How can fix this error
  Can someone help me</p>