I am storing data in the database where I want to increment the date by one month. I have given the code below. The first row is inserted successfully but after that, data didn't get inserted correctly.
$startMonth = $wallet_master->created_at;
// 31-5-2022
$endMonth = $wallet_master->created_at->addDays(30);
//30-6-2022
for ($i = 0; $i < $wallet_package->wallet_duration; $i++) {
$data = [
'start_date' => $startMonth,
'end_date' => $endMonth,
];
DB::table('wallet_table')->insert($data);
$startMonth = $endMonth->addDays(1);
$endMonth = $startMonth->addDays(30);