I try to insert data in my custom table
$month = date('m');
$year = date('y');
$number = cal_days_in_month(CAL_GREGORIAN, $month, $year);
for ($i = 0; $i < $number; $i++){
$test= new Test();
$test->cuid = $user->id;
$test->name = $user->name;
$test->month = date('m');
$test->created_at = '2018-04-'+$i;
$test->save();
}
i try to insert number record in a month
let's say April have 30 days i try to insert it working fine but in created_at field i need insert 2018-04-01 to 2018-04-30 but this is insert only current date so that i try above but not working
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire