here is how data is updating in the DB with the page refresh but i want it to update automaticaaly after every 5 minutes so that without refreshing my data becomes visables on welcome page as well as the data is inserted automatically on function call(that should be after every 5 minutes). i am a beginner i tried to learn from laravel documentation but its not exactly displaying what i need.. your help will be appriciated... here is the code of how i am inserting data in the DB:
foreach($files as $file){
if (Invoice::where('file_name', '=', $file['file_name'])->exists()) {
}
else {
$store = new Invoice;
$store->file_name = $file['file_name'];
$store->name = $file['customer_name'];
$store->po_no = $file['po'];
$store->address = $file['city'];
$store->total_items = count($file['products']);
$store->save();
$invid = $store->id;
for($x = 0; $x < count($file['products']); $x++)
{
$pstore = new InvoiceProduct;
$pstore->product_name = $file['products'][$x];
$pstore->invoice_id = $invid;
$pstore->quantity =$file['count'][$x];
$pstore->barcode=$file['scan'][$x];
$pstore->vendor_code =$file['vn'][$x];
$pstore->save();
}
}
and the function name is index i want to schedule this function every 5 minutes.. Thank you!
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire