title: Laravel save one to many relationship
body: <p>I have the following relationships set up in Laravel:</p>
  
  <pre><code>OrderStatus Model
    - hasMany('Order')
  
   Order Model
    - 'belongsTo('OrderStatus');
  </code></pre>
  
  <p>The database is set up with an <code>orders</code> table and an <code>order_statuses</code> table. The <code>orders</code> table has a field for <code>order_status_id</code>.</p>
  
  <p>When I save an Order, I manually set the <code>order_status_id</code> by fetching the appropriate Order Status model, like this:</p>
  
  <pre><code>$status = OrderStatus::where(['name'=&gt;'sample_status'])-&gt;firstOrFail();
  $order-&gt;order_status_id = $status-&gt;id;
  $order-&gt;save();
  </code></pre>
  
  <p>I'm wondering if there is a built in function to do this rather than setting the <code>order_status_id</code> manually. I've read about "Attaching a related model", and "Associating Models" in the Laravel docs, but I can't figure out if these fit my use case. I think the issue I'm having is that I'm working directly with the child model (the order), and trying to set it's parent. Is there a function for this?</p>