Files
admin-php-module/commands/GETReports.php
miroman-afk 5b1c774259 v.2.13
-Add delete reports
2022-02-01 02:47:25 +03:00

35 lines
819 B
PHP

<?php
namespace App\Commands;
use App\Component\Models\Report;
use App\Console\Commands\HRCCommand;
use App\Console\Commands\HRCCommandInterface;
class GETReports extends HRCCommand implements HRCCommandInterface {
protected $signature = 'getreports';
public function command($input, $output = null) {
$reports = Report::all();
if ($reports) {
foreach ($reports as $key => $report) {
$data[] = array(
'id' => $report['id'],
'name' => $report['name'],
'type' => $report['report_type'],
'start_date' => date('d.m.Y', strtotime($report['start_date'])),
'end_date' => date('d.m.Y', strtotime($report['end_date'])),
);
}
return [
'status' => 'success',
'reports' => $data,
];
} else {
return [
'status' => 'success',
'reports' => [],
];
}
}
}