35 lines
819 B
PHP
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' => [],
|
|
];
|
|
}
|
|
}
|
|
} |