title: Record exist in another table, before inserting-Laravel
body: <p>I'm new to Laravel framework so please be patient, I have two  tables the user  and the received_pay tables, the challenge is I want to check in received_pay first for the email and receipt_number if they match with the user input during registration if they match then new user is created otherwise rejected, below is my tables details</p>
  
  <p>user:
  id, username, email, remember_token, created_at, updated_at</p>
  
  <p>received_pay:
  id, email, receipt_number</p>
  
  <p>my register controllers code for user is:</p>
  
  <pre><code>protected function create(array $data)
  {
      if (Received_pay::where('email', '=', Input::get('email'))-&gt;exists()) {
      // user found
          echo "user exist";
       }
      return User::create([
          'username' =&gt; $data['username'],
          'email' =&gt; $data['email'],
          'password' =&gt; bcrypt($data['password']),
          'token'   =&gt; $data['token'],
      ]);
  </code></pre>