title: Laravel Update if record exists or Create if not
body: <p>I want to update my record if it exists but create new one if not exists. here is i got so far:</p>
  
  <pre><code> MerchantBranch.php
  public function token()
  {
     return $this-&gt;hasOne('App\MerchantBranchToken');
  }
  
  MerchantBranchToken.php
  public function merchant_branch()
  {
     return $this-&gt;belongsTo('App\MerchantBranch');
  }
  
  $find = MerchantBranchToken::find($id);
  
      if (!$find) {
          $branch = new MerchantBranchToken(['token' =&gt; $token]);
          MerchantBranch::find($id)-&gt;token()-&gt;save($branch);
      } else {
          $find-&gt;token = $token;
          $find-&gt;save();
      }  
  </code></pre>
  
  <p>It's working perfectly. </p>
  
  <p>But as i know Laravel is very powerful for its eloquent model. 
  Can I make it shorter? or i already doing it correctly?.</p>
  
  <p>I've tried using "updateOrCreate" method but my foreign key "merchant_branch_id" need to be fillable.</p>