I'm trying to build a website builder, where I want to store HTML structure of the plugins/portlets manually, where user can have the structure and whatever editable data they are inserting, gets stored into database using serialize in the controller, now I came to know MySQL doesn't hold html data or say it is unsafe to store, I decided to store the basic structure into JSON format into a separate file, Now I don't want to have these JSON files in my public folder destination, I went through the Seeder documentation and tutorial to find path of the file and get the JSON data. Also went through this tutorial
and came across following class:
<?php
use Illuminate\Database\Seeder;
use App\User;
class PortletTableSeeder extends Seeder {
public function run()
{
$json = File::get("database/data/portlets.json");
$data = json_decode($json);
foreach ($data as $obj) {
'id' => $obj->id,
'html_code' => $obj->html_code,
'dummy_data' => $obj->dummy_data,
//more objects..
));
}
}
}
?>
Is it the correct way of executing this? and calling it into blade file for example I have mixstyles by the name if id of the theme/portlet in gulpfile can I have like this:
<link href="css/{{$id}}.css" rel="stylesheet" type="text/css" />