title: Laravel: check if two users are simultaneously logged in
body: <p>I want to validate the use of coupons in my app by checking if both the business' owner and the final client are the ones <em>redeeming</em> the coupon. This would be the process:</p>
  
  <ul>
  <li><strong>Client</strong> shows his QR code</li>
  <li><strong>Owner</strong> scans it</li>
  <li><strong>Coupon</strong> is redeemed if both of them are logged in (this would happen when the <strong>Owner</strong>'s device makes a <code>post</code> request and uses <code>CouponController</code>)</li>
  </ul>
  
  <p>I know I can use <code>auth()</code> to validate the owner's status (he wouldn't be able to access the <em>Redeem</em> view when logged out anyway), but is there any way to check if the <strong>Client</strong> is also logged in without modifying the <code>User</code> row in the database? Right now, I use the following:</p>
  
  <pre><code>&lt;?php
      namespace App\Http\Controllers\Auth;
      use App\User;
      use App\Http\Controllers\Controller;
  
      class LoginController extends Controller
      {
        ...
  
        public function store()
        {
            if( !auth()-&gt;attempt(request(['email','password'])) ){
                return back()-&gt;withErrors([
                   'message' =&gt; 'Please check your credentials and try again.'
                ]);
            }
  
            $user = User::find(auth()-&gt;id());
            $user-&gt;active = 1;
            $user-&gt;save();
  
            return redirect()-&gt;home();
        }
  </code></pre>