title: How can insert data into user_level whenever new user register under referral link id
body: <p>I create user registeration system with referral link .I want new users to count as level 1 , level 2 users lists and want to credit to sponsor user. I mean if new user register under referral link of user A,he will get referral bonus as amazon. So need to count users in level 1 and level 2. I will only pay for this two level. So I need to insert data whenever new user register as what level of sponsor user. and need to credit to sponsor user.</p>
  
  <p>I have table as this</p>
  
  <pre><code>public function up()
  {
     Schema::create('users', function (Blueprint $table) {
         $table-&gt;increments('id');
         $table-&gt;string('name');
         $table-&gt;string('email')-&gt;unique();
         $table-&gt;integer('user_level')-&gt;nullable();
         $table-&gt;string('referred_by')-&gt;nullable();
         $table-&gt;string('affiliate_id')-&gt;unique();
         $table-&gt;string('password');
         $table-&gt;rememberToken();
         $table-&gt;timestamps();
     });
   }
  </code></pre>
  
  <p>I need to edit in register controller .How can insert data for user_level . For first user registeration ,it will be Null. But new user under him need to be level 1 and second generation need to be level 2. How can do it.</p>
  
  <pre><code>protected function create(array $data)
  {
     $referred_by = Cookie::get('referral');
  
     $user =  User::create([
                  'name' =&gt; $data['name'],
                  'email' =&gt; $data['email'],
                  'password' =&gt; Hash::make($data['password']),
                  'affiliate_id' =&gt; str_random(10),
                  'referred_by'   =&gt; $referred_by,
              ]);
  
      return $user;
  }
  </code></pre>