Sunday, March 19, 2017

Adding onto an HTML view from Laravel Seeder

So, I have a seeder class in a project I'm working on that essentially looks through a csv file and checks for differences/changes between it and a table in my database and one other data set. In total, I will be keeping track of 3 different sets of data with the same 8 column names, that could all have potential differences. I'm trying to make it so that if the same column has a different value in all three datasets, I can add a <table> to an existing html file within the <body> tag. This table would highlight the specific column(s) that have different values in each dataset, while also listing the other columns that do not contain conflicts.

So in my php (seeder) code, I would have something like this

if (there is a conflict)
    create a new <table> in conflict-logs.html
    fill it in with data from $csv and $db

And then my Table with all the values for each instance (there will potentially be multiple of these added to the same layout through multiple uses of this seeder)

So how could I get this done? I know how to write to a file, but not append tables within an existing HTML file. Thanks!



via bcardell

Advertisement