title: Update a table and its related model in laravel?
body: <p>I have client table and client_address info table. I need to update both table when updating client.my model classes given below,</p>
  
  <pre><code>        class Client extends Model {
               public function addressInfo() {
                return $this-&gt;hasOne('App\Model\ClientAddressInfo');
               }
          }
  
        class ClientAddressInfo extends Model {    
              protected $table = 'client_address_info';    
                public function client() {
                 return $this-&gt;belongsTo('App\Model\Client');
              }
       }
  </code></pre>
  
  <p>My controller for updating is given below.</p>
  
  <pre><code>$client = Client::findOrFail($id);
  $client-&gt;name = rand(0, 1222222);
  $address = ClientAddressInfo::where('client_id', '=', $id)-&gt;get();
  $address-&gt;street = "new street";
  $address-&gt;save();
  </code></pre>
  
  <p>But it is not working,Could you please explain the best practice for updating model and its related models.</p>