title: Laravel Check If Related Model Exists
body: <p>I have an Eloquent model which has a related model:</p>
  
  <pre><code>public function option() {
      return $this-&gt;hasOne('RepairOption', 'repair_item_id');
  }
  
  public function setOptionArrayAttribute($values)
  {
      $this-&gt;option-&gt;update($values);
  }
  </code></pre>
  
  <p>When I create the model, it does not necessarily have a related model. When I update it, I might add an option, or not.</p>
  
  <p>So I need to check if the related model exists, to either update it, or create it, respectively:</p>
  
  <pre><code>$model = RepairItem::find($id);
  if (Input::has('option')) {
      if (&lt;related_model_exists&gt;) {
          $option = new RepairOption(Input::get('option'));
          $option-&gt;repairItem()-&gt;associate($model);
          $option-&gt;save();
          $model-&gt;fill(Input::except('option');
      } else {
         $model-&gt;update(Input::all());
      }
  };
  </code></pre>
  
  <p>Where <code>&lt;related_model_exists&gt;</code> is the code I am looking for.</p>