<table border="5">

    <tbody>
        <tr>
        <th>Date</th>
        <th>Amount</th>
        <th>Total Day</th>
        <th>Interes</th>
    </tr>
    </tbody>
    @php $sum = 0; @endphp
    @foreach($amount as $amt)
<tr>
    <td>{{$amt->date}}</td>
    <td>{{$amt->amount}}</td>
    <td>
<?php
  $day=array();
  $date = Carbon\Carbon::now()->diffInDays($amt->date);
  $interest = $date*$amt->amount;
  $sum += $interest
//   echo $date;
?>
{{$date}}
    </td>
    <td>{{$interest}}</td>
</tr>
@endforeach
</table>


<h1>Sum = {{$sum}} </h1>




public function interest()
    {
        // $currentDateTime = Carbon::now()->diffInDays('5/7/2022' );;

        $amount=DB::table('Amount')->get();


        $day=array();
        foreach($amount as $amt)
        {
            $date = Carbon::now()->diffInDays($amt->date);
            array_push($day,$date);

        }

        $data=compact('amount');
        return view('website.table')->with($data);


    }