Estou fazendo um relatório mensal de um aplicação php com o Laravel 5.7, mas ele está retornando apenas informações NULL provenientes da página através do banco de dados. Estou usando o Mysql. Alguém pode ajudar? Este é meu controlador.
class ReportController extends Controller
{
public function index(){
$output = public_path() . '/reports/' . time() . '_MidiaSocial';
$input = public_path().'/reports/Sistema.jrxml';
$report = new PHPJasper;
$report->process(
$input,
$output,
array("pdf"),
array(),
[
'driver' => 'generic',
'host' => env('DB_HOST', 'localhost'),
'port' => env('DB_PORT', '3306'),
'database' => env('DB_DATABASE', 'calculosorte'),
'username' => env('DB_USERNAME', 'root'),
'password' => env('DB_PASSWORD', ''),
'jdbc_driver' => 'com.mysql.jdbc.Driver',
'jdbc_url' => 'jdbc:mysql://'.env('DB_HOST', 'localhost').':'.env('DB_PORT', '3306').';databaseName='.env('DB_DATABASE', 'calculosorte'),
'jdbc_dir' => base_path().env('JDBC_DIR', 'vendor/geekcom/phpjasper/bin/jasperstarter/jdbc/')
]
)->execute();
$file = $output.'.pdf';
$path = $file;
if (!file_exists($file)) {
abort(404);
}
$file = file_get_contents($file);
unlink($path);
return response($file, 200)
->header('Content-Type', 'application/pdf')
->header('Content-Disposition', 'inline; filename="midia_social.pdf"');
}
}