public function store()
{
$input = Input::all();
$file = Input::file('file');
$filename = $file->getClientOriginalName();
$file->move(temp_path(), $filename);
$filename = str_replace('.ZIP', '.zip', $filename);
$unzipSuccess = Unzip(temp_path() . "/{$filename}", temp_path());
$contents = file_get_contents(temp_path() . "/report_generator.json");
$report_info = json_decode($contents, true);
$input = array('name' => $report_info['name'], 'author' => $report_info['author'], 'version' => $report_info['version'], 'website' => $report_info['website'], 'modules' => json_encode($report_info['modules']), 'show_calendars' => $report_info['show_calendars']);
if ($report_generator = ReportGenerator::where('name', '=', $input['name'])->first()) {
$report_generator->update($input);
} else {
$report_generator = ReportGenerator::create($input);
}
return Redirect::to("{$this->link_type}/report-generators")->with('success_message', trans('success_messages.report_generator_install'));
}