Files
admin-php-module/commands/GETReports.php
miroman-afk 506636d35c v.2.14
Update migrations
2022-02-05 15:26:43 +03:00

42 lines
933 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'])),
);
}
if (isset($data)) {
return [
'status' => 'success',
'reports' => $data,
];
} else {
return [
'status' => 'success',
'reports' => [],
];
}
} else {
return [
'status' => 'success',
'reports' => [],
];
}
}
}