I have a simple array that returned when executing:
$this->forecast($value->id,$value->db_connection)
for some reason when i call the $reports::create($data)
it duplicates each row, i have added some logic to print out $data within the foreach and it never returns duplicates, when printing the $result object it has 2 entries.
any idea where i am going wrong?
public function store() // function to store report data in db
{
$reports = new Reports;
$companyData = new ClientSettings;
$settings = $companyData::all();
foreach ($settings as $value) {
$data = $this->forecast($value->id,$value->db_connection);
$result = $reports::create($data);
}
echo "Forecast generated";
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire