title: Laravel belongsTo coalesce?
body: <p>I'm trying to add a relation to my <code>Booking</code> model. I already have a relation that looks like this:</p>
  
  <pre><code>public function vehicle() {
      return $this-&gt;belongsTo(Vehicle::class);
  }
  </code></pre>
  
  <p>Which works on the column <code>bookings.vehicle_id</code>. However, now I'm adding another column called <code>bookings.billed_vehicle_id</code> which will "override" the <code>vehicle_id</code> if it's not null. So I want to do something like this:</p>
  
  <pre><code>public function billedVehicle() {
      return $this-&gt;belongsTo(Vehicle::class,DB::raw('coalesce(billed_vehicle_id,vehicle_id)'));
  }
  </code></pre>
  
  <p>Is this possible?</p>
  
  <p>And if not possible with <code>belongsTo</code> can I somehow create a custom relation that'll support this?</p>