Carbon difference between two dates to get a decimal for hourly rate calculations

Unfortunately, diffInHours only take two parameters. Maybe, you can try diffInMinutes though and then get the value you require from there?

For e.g.

$actual_start_at = Carbon::parse('2017-05-01 13:00:00');
$actual_end_at   = Carbon::parse('2017-05-01 15:15:00');
$mins            = $actual_end_at->diffInMinutes($actual_start_at, true);

dd($mins/60);

would output

2.25

Also, if you use the diff() method, it would return a DateInterval object instead.

$mins = $actual_end_at->diff($actual_start_at, true);

and then dd($mins) would output:

DateInterval {#913 ▼
  +"y": 0
  +"m": 0
  +"d": 0
  +"h": 2
  +"i": 15
  +"s": 0
  +"f": 0.0
  +"weekday": 0
  +"weekday_behavior": 0
  +"first_last_day_of": 0
  +"invert": 0
  +"days": 0
  +"special_type": 0
  +"special_amount": 0
  +"have_weekday_relative": 0
  +"have_special_relative": 0
}